Files
2025-12-05 16:49:54 +08:00

71 lines
3.5 KiB
XML

<UserControl x:Class="DWMBlurGlassGUI.Views.Controls.ColorSettingItem"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:DWMBlurGlassGUI.Views.Controls"
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
mc:Ignorable="d"
d:DesignHeight="50" d:DesignWidth="400"
x:Name="Root">
<UserControl.Resources>
<ControlTemplate x:Key="ItemButtonTemplate" TargetType="Button">
<Border x:Name="Border"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{DynamicResource ControlCornerRadius}"
Padding="{TemplateBinding Padding}">
<ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="Border" Property="Background" Value="{DynamicResource ControlFillColorSecondaryBrush}"/>
<Setter TargetName="Border" Property="BorderBrush" Value="{DynamicResource ControlElevationBorderBrush}"/>
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter TargetName="Border" Property="Background" Value="{DynamicResource ControlFillColorTertiaryBrush}"/>
<Setter TargetName="Border" Property="Opacity" Value="0.7"/>
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter TargetName="Border" Property="Opacity" Value="0.5"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</UserControl.Resources>
<Button Command="{Binding PickColorCommand, ElementName=Root}"
CommandParameter="{Binding CommandParameter, ElementName=Root}"
Background="Transparent"
BorderBrush="{DynamicResource CardStrokeColorDefaultBrush}"
BorderThickness="1"
Padding="8,4"
Width="200"
HorizontalContentAlignment="Stretch"
VerticalContentAlignment="Center"
Template="{StaticResource ItemButtonTemplate}">
<Grid VerticalAlignment="Center">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Border Grid.Column="0"
Width="20"
Height="20"
Margin="0,0,10,0"
CornerRadius="3"
Background="{Binding ColorBrush, ElementName=Root}"
BorderBrush="#33000000"
BorderThickness="1"
VerticalAlignment="Center"/>
<TextBlock Grid.Column="1"
Text="{Binding ColorText, ElementName=Root}"
VerticalAlignment="Center"
FontSize="12"/>
</Grid>
</Button>
</UserControl>