Files
ShrlAlgoToolkit/WPFluent/Controls/Badge/Badge.xaml
ShrlAlgo 4d35cadb56 更新
2025-07-11 09:20:23 +08:00

55 lines
3.3 KiB
XML

<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:controls="clr-namespace:WPFluent.Controls"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<!--<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/WPFluent;component/Themes/Light.xaml"/>
</ResourceDictionary.MergedDictionaries>-->
<Style TargetType="{x:Type controls:Badge}">
<Setter Property="Foreground" Value="{DynamicResource TextOnAccentFillColorPrimaryBrush}" />
<Setter Property="Background" Value="{DynamicResource SystemFillColorAttentionBrush}" />
<!-- <Setter Property="BorderBrush" Value="{DynamicResource SystemAccentBrush}" /> -->
<Setter Property="BorderBrush" Value="Transparent" />
<Setter Property="Padding" Value="4" />
<Setter Property="Focusable" Value="False" />
<Setter Property="SnapsToDevicePixels" Value="True" />
<Setter Property="OverridesDefaultStyle" Value="True" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type controls:Badge}">
<Border
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="1"
CornerRadius="4"
Padding="{TemplateBinding Padding}"
x:Name="Border">
<ContentPresenter VerticalAlignment="Center" />
</Border>
<ControlTemplate.Triggers>
<Trigger Property="Appearance" Value="Accent">
<Setter Property="Foreground" Value="{DynamicResource TextOnAccentFillColorPrimaryBrush}" />
</Trigger>
<Trigger Property="Appearance" Value="Transparent">
<Setter Property="BorderBrush" Value="{DynamicResource ControlElevationBorderBrush}" />
<Setter Property="Background" TargetName="Border" Value="Transparent" />
</Trigger>
<Trigger Property="Appearance" Value="Attention">
<Setter Property="Background" TargetName="Border" Value="{DynamicResource SystemFillColorAttentionBrush}" />
</Trigger>
<Trigger Property="Appearance" Value="Caution">
<Setter Property="Background" TargetName="Border" Value="{DynamicResource SystemFillColorCautionBrush}" />
</Trigger>
<Trigger Property="Appearance" Value="Critical">
<Setter Property="Background" TargetName="Border" Value="{DynamicResource SystemFillColorCriticalBrush}" />
</Trigger>
<Trigger Property="Appearance" Value="Success">
<Setter Property="Background" TargetName="Border" Value="{DynamicResource SystemFillColorSuccessBrush}" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>