Files
GeekDesk/Control/Other/GradientBGDialog.xaml
2025-03-07 10:59:39 +08:00

83 lines
4.5 KiB
XML

<Border x:Class="GeekDesk.Control.Other.GradientBGDialog"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:hc="https://handyorg.github.io/handycontrol"
CornerRadius="4"
>
<Grid>
<StackPanel>
<Grid Width="750"
Height="550"
Panel.ZIndex="0"
MouseDown="DragMove"
>
<Grid.Background>
<SolidColorBrush Color="Black" Opacity="0.01"/>
</Grid.Background>
</Grid>
<hc:TransitioningContentControl TransitionMode="Fade"
Panel.ZIndex="99"
Width="600"
Height="400"
Margin="0,-620,0,0">
<Border Style="{StaticResource BorderBG}">
<Grid>
<TextBlock Text="提示: 右键点击可以删除自定义的背景颜色哦" Foreground="Gray" HorizontalAlignment="Center" Margin="0,5,0,0"/>
<ListBox x:Name="GradientBGs"
ItemsSource="{Binding}"
Background="Transparent"
Margin="20,20,20,50"
BorderThickness="0"
>
<ListBox.Resources>
<ContextMenu x:Key="CMDialog" Width="200">
<MenuItem Header="删除" Click="Delete" Tag="{Binding}"/>
</ContextMenu>
</ListBox.Resources>
<ListBox.ItemContainerStyle>
<Style TargetType="ListBoxItem">
<Setter Property="ContextMenu" Value="{StaticResource CMDialog}"/>
<Setter Property="Margin" Value="10"/>
<Setter Property="Effect" Value="{StaticResource EffectShadow2}"/>
</Style>
</ListBox.ItemContainerStyle>
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel Background="Transparent"/>
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
<ListBox.ItemTemplate>
<DataTemplate>
<Border CornerRadius="4" Width="100" Height="100"
MouseLeftButtonDown="BGBorder_MouseLeftButtonDown"
Tag="{Binding}">
<Border.Background>
<LinearGradientBrush>
<GradientStop Offset="0" Color="{Binding Color1}"/>
<GradientStop Offset="1" Color="{Binding Color2}"/>
</LinearGradientBrush>
</Border.Background>
<Border Width="100" Height="30" VerticalAlignment="Bottom">
<Border.Background>
<SolidColorBrush Color="Gray" Opacity="0.4"/>
</Border.Background>
<TextBlock Text="{Binding Name}" TextAlignment="Center" VerticalAlignment="Center" FontSize="17" FontWeight="Bold" Foreground="White"/>
</Border>
</Border>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
<hc:UniformSpacingPanel Spacing="10" Grid.ColumnSpan="4">
<Button Content="关闭" Style="{StaticResource MyBtnStyle}" Click="Close_Click" HorizontalAlignment="Stretch" Margin="524,360,-524,10" VerticalAlignment="Stretch"/>
</hc:UniformSpacingPanel>
</Grid>
</Border>
</hc:TransitioningContentControl>
</StackPanel>
</Grid>
</Border>