Files
ShrlAlgoToolkit/AntdWpf/Styles/CheckableTag.xaml

87 lines
5.4 KiB
Plaintext
Raw Normal View History

2025-07-11 09:20:23 +08:00
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="clr-namespace:AntdWpf.Controls"
xmlns:helpers="clr-namespace:AntdWpf.Helpers">
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/AntdWpf;component/Styles/Converters.xaml" />
<ResourceDictionary Source="pack://application:,,,/AntdWpf;component/Styles/Animations.xaml" />
</ResourceDictionary.MergedDictionaries>
<Style TargetType="{x:Type controls:CheckableTag}">
<Setter Property="Padding" Value="8 4" />
<Setter Property="Margin" Value="0 0 8 0" />
<Setter Property="SnapsToDevicePixels" Value="True" />
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="HorizontalContentAlignment" Value="Center" />
<Setter Property="FontSize" Value="{DynamicResource TagFontSize}" />
<Setter Property="FontFamily" Value="{DynamicResource FontFamily}" />
<Setter Property="Foreground" Value="{DynamicResource TagDefaultForeground}" />
2025-07-12 23:31:32 +08:00
<Setter Property="helpers:AntdControl.CornerRadius" Value="{DynamicResource BorderRadiusBase}" />
2025-07-11 09:20:23 +08:00
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type controls:CheckableTag}">
2025-07-12 23:31:32 +08:00
<controls:AntdBorder x:Name="Border"
2025-07-11 09:20:23 +08:00
UseLayoutRounding="True"
Padding="{TemplateBinding Padding}"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
2025-07-12 23:31:32 +08:00
BorderStyle="{TemplateBinding helpers:AntdControl.BorderStyle}"
CornerRadius="{TemplateBinding helpers:AntdControl.CornerRadius}">
2025-07-11 09:20:23 +08:00
<!-- Content -->
<ContentPresenter Content="{TemplateBinding Content}"
ContentTemplate="{TemplateBinding ContentTemplate}"
ContentStringFormat="{TemplateBinding ContentStringFormat}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
ContentTemplateSelector="{TemplateBinding ContentTemplateSelector}" />
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualStateGroup.Transitions>
<VisualTransition GeneratedDuration="0:0:0.3" GeneratedEasingFunction="{StaticResource EaseOut}" />
</VisualStateGroup.Transitions>
<VisualState x:Name="Normal" />
<VisualState x:Name="MouseOver">
<Storyboard>
<DoubleAnimation Storyboard.TargetProperty="Opacity"
To="0.85" />
</Storyboard>
</VisualState>
<VisualState x:Name="Disabled" />
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
2025-07-12 23:31:32 +08:00
</controls:AntdBorder>
2025-07-11 09:20:23 +08:00
<ControlTemplate.Triggers>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsChecked" Value="True" />
<Condition Property="IsPressed" Value="True" />
</MultiTrigger.Conditions>
<Setter TargetName="Border"
Property="Background"
Value="{Binding Background,
Mode=OneWay,
ConverterParameter=7,
RelativeSource={RelativeSource Mode=TemplatedParent},
Converter={StaticResource ColorPaletteConverter}}" />
</MultiTrigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Foreground" Value="{DynamicResource PrimaryBrush}" />
</Trigger>
<Trigger Property="IsChecked" Value="True">
<Setter Property="Foreground" Value="White" />
<Setter Property="Background" Value="{DynamicResource PrimaryBrush}" />
</Trigger>
</Style.Triggers>
</Style>
</ResourceDictionary>