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

42 lines
2.2 KiB
XML

<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Style TargetType="{x:Type ListBoxItem}" x:Key="DefaultListBoxItemStyle">
<Setter Property="Foreground" Value="{DynamicResource TextFillColorPrimaryBrush}" />
<Setter Property="Background" Value="{DynamicResource SystemFillColorAttentionBrush}" />
<Setter Property="BorderBrush" Value="{DynamicResource SystemFillColorAttentionBrush}" />
<Setter Property="Margin" Value="0" />
<Setter Property="Padding" Value="12" />
<Setter Property="Border.CornerRadius" Value="0" />
<Setter Property="SnapsToDevicePixels" Value="True" />
<Setter Property="OverridesDefaultStyle" Value="True" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ListBoxItem}">
<Border
Background="Transparent"
BorderThickness="1"
CornerRadius="{TemplateBinding Border.CornerRadius}"
Margin="0"
Padding="{TemplateBinding Padding}"
x:Name="Border">
<ContentPresenter />
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" TargetName="Border" Value="{DynamicResource SubtleFillColorTertiaryBrush}" />
</Trigger>
<Trigger Property="IsSelected" Value="True">
<Setter Property="Background" TargetName="Border" Value="{DynamicResource SystemFillColorAttentionBrush}" />
<Setter Property="Foreground" Value="{DynamicResource TextOnAccentFillColorPrimaryBrush}" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style BasedOn="{StaticResource DefaultListBoxItemStyle}" TargetType="{x:Type ListBoxItem}" />
</ResourceDictionary>