Files
Shrlalgo.RvKits/Melskin/Controls/ListBox.xaml

611 lines
37 KiB
Plaintext
Raw Normal View History

2025-08-20 12:10:13 +08:00
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
2026-01-02 17:30:41 +08:00
xmlns:assists="clr-namespace:Melskin.Assists"
xmlns:decorations="clr-namespace:Melskin.Controls.Decorations"
xmlns:internal="clr-namespace:Melskin.Converters.Internal"
2026-01-02 17:30:30 +08:00
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
2026-01-02 17:30:30 +08:00
<Style TargetType="ListBox" x:Key="SlideTabGroupListBoxStyle">
2025-08-20 12:10:13 +08:00
<Setter Property="Background" Value="{DynamicResource ControlBackgroundNormalBrush}" />
2025-08-24 13:49:55 +08:00
<Setter Property="BorderThickness" Value="1" />
2025-08-20 12:10:13 +08:00
<Setter Property="assists:ControlAssist.CornerRadius" Value="4" />
2025-12-23 21:35:54 +08:00
<Setter Property="assists:ControlAssist.Orientation" Value="Horizontal" />
2025-08-20 12:10:13 +08:00
<Setter Property="Foreground" Value="{DynamicResource TextPrimaryBrush}" />
<Setter Property="ItemContainerStyle">
<Setter.Value>
<Style TargetType="{x:Type ListBoxItem}">
<Setter Property="Background" Value="Transparent" />
<Setter Property="Foreground" Value="{DynamicResource TextSecondaryBrush}" />
<!-- 默认文字颜色 -->
<Setter Property="FontSize" Value="16" />
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
<Setter Property="Padding" Value="15,10" />
<!-- 增加一些内边距让选项卡不那么拥挤 -->
<Setter Property="HorizontalContentAlignment" Value="Center" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ListBoxItem}">
<Grid Background="Transparent">
<!-- 选中指示器 -->
<decorations:SlotBorder
CornerRadius="{Binding Path=(assists:ControlAssist.CornerRadius), RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ListBox}}"
Intensity="0.2"
2026-01-02 17:30:30 +08:00
Padding="-4"
2025-09-12 09:55:36 +08:00
ShaderEnabled="False"
2026-01-02 17:30:30 +08:00
Visibility="Collapsed"
x:Name="slot" />
2025-08-20 12:10:13 +08:00
<ContentPresenter
2025-12-23 21:35:54 +08:00
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
2026-01-02 17:30:30 +08:00
Margin="{TemplateBinding Padding}"
TextElement.Foreground="{TemplateBinding Foreground}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
2025-08-20 12:10:13 +08:00
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsSelected" Value="True">
<!-- 被选中时,仅改变文字颜色 -->
<Setter Property="Foreground" Value="{DynamicResource PrimaryNormalBrush}" />
2026-01-02 17:30:30 +08:00
<Setter Property="ShaderEnabled" TargetName="slot" Value="True" />
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Foreground" Value="{DynamicResource TextDisabledBrush}" />
2025-08-20 12:10:13 +08:00
</Trigger>
2025-09-12 09:55:36 +08:00
<!-- 多选时,隐藏指示器 -->
<DataTrigger Binding="{Binding Path=SelectionMode, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ListBox}}" Value="Multiple">
2026-01-02 17:30:30 +08:00
<Setter Property="Visibility" TargetName="slot" Value="Visible" />
</DataTrigger>
<DataTrigger Binding="{Binding Path=SelectionMode, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ListBox}}" Value="Extend">
2026-01-02 17:30:30 +08:00
<Setter Property="Visibility" TargetName="slot" Value="Visible" />
</DataTrigger>
2025-08-20 12:10:13 +08:00
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Setter.Value>
</Setter>
<Setter Property="ItemsPanel">
<Setter.Value>
<ItemsPanelTemplate>
2025-12-23 21:35:54 +08:00
<StackPanel Orientation="{Binding Path=(assists:ControlAssist.Orientation), RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ListBox}}" />
2025-08-20 12:10:13 +08:00
</ItemsPanelTemplate>
</Setter.Value>
</Setter>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ListBox">
<Grid>
2025-09-04 22:39:00 +08:00
<decorations:EmbossBorder
2025-08-20 12:10:13 +08:00
CornerRadius="{TemplateBinding assists:ControlAssist.CornerRadius}"
2026-01-02 17:30:30 +08:00
Intensity="0.8"
Margin="-4" />
2025-08-20 12:10:13 +08:00
<!-- Canvas 用于精确定位滑块 -->
<Canvas x:Name="PART_SlideCanvas">
2025-08-20 12:10:13 +08:00
<!-- 滑块元素Name 是关键,行为代码通过它来查找并控制动画 -->
2025-09-04 22:39:00 +08:00
<decorations:SlotBorder
2025-08-20 12:10:13 +08:00
CornerRadius="{Binding Path=(assists:ControlAssist.CornerRadius), RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ListBox}}"
Intensity="0.2"
2026-01-02 17:30:30 +08:00
Padding="-4"
ShaderEnabled="True"
x:Name="PART_SelectionIndicator">
2025-09-04 22:39:00 +08:00
<decorations:SlotBorder.RenderTransform>
2025-08-20 12:10:13 +08:00
<TranslateTransform />
2025-09-04 22:39:00 +08:00
</decorations:SlotBorder.RenderTransform>
</decorations:SlotBorder>
2025-08-20 12:10:13 +08:00
</Canvas>
<!-- ItemsPresenter 必须在滑块上层,以显示所有 Tab 项 -->
<ItemsPresenter />
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsEnabled" Value="false">
<Setter Property="Foreground" Value="{DynamicResource TextDisabledBrush}" />
</Trigger>
2025-09-12 09:55:36 +08:00
<!-- 隐藏滑块 -->
<Trigger Property="SelectionMode" Value="Multiple">
2026-01-02 17:30:30 +08:00
<Setter Property="Visibility" TargetName="PART_SlideCanvas" Value="Collapsed" />
</Trigger>
<Trigger Property="SelectionMode" Value="Extended">
2026-01-02 17:30:30 +08:00
<Setter Property="Visibility" TargetName="PART_SlideCanvas" Value="Collapsed" />
</Trigger>
</ControlTemplate.Triggers>
2025-08-20 12:10:13 +08:00
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
2026-01-02 17:30:30 +08:00
<Style TargetType="ListBox" x:Key="TabGroupListBoxStyle">
2025-08-20 12:10:13 +08:00
<Setter Property="Background" Value="{DynamicResource ControlBackgroundNormalBrush}" />
<Setter Property="BorderThickness" Value="0" />
2025-12-23 21:35:54 +08:00
<Setter Property="assists:ControlAssist.Orientation" Value="Horizontal" />
<Setter Property="assists:ControlAssist.CornerRadius" Value="10" />
<Setter Property="ItemContainerStyle">
<Setter.Value>
<Style TargetType="{x:Type ListBoxItem}">
<Setter Property="Background" Value="{DynamicResource ControlBackgroundNormalBrush}" />
<Setter Property="Foreground" Value="{DynamicResource TextPrimaryBrush}" />
<Setter Property="FontSize" Value="16" />
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ListBoxItem}">
<Grid>
<Border
Background="{TemplateBinding Background}"
CornerRadius="{Binding Path=(assists:ControlAssist.CornerRadius), RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ListBox}}"
2026-01-02 17:30:30 +08:00
Cursor="Hand"
x:Name="Border">
2025-12-23 21:35:54 +08:00
<ContentPresenter
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
2026-01-02 17:30:30 +08:00
Margin="10"
TextElement.Foreground="{TemplateBinding Foreground}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
2025-12-23 21:35:54 +08:00
</Border>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter Property="Foreground" Value="{DynamicResource PrimaryNormalBrush}" />
<Setter Property="Background" Value="{DynamicResource ControlBackgroundSelectedBrush}" />
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Foreground" Value="{DynamicResource TextDisabledBrush}" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Setter.Value>
</Setter>
<!-- 设置布局面板为水平排列 -->
<Setter Property="ItemsPanel">
<Setter.Value>
<ItemsPanelTemplate>
<StackPanel Orientation="{Binding Path=(assists:ControlAssist.Orientation), RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ListBox}}" />
</ItemsPanelTemplate>
</Setter.Value>
</Setter>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ListBox">
<ItemsPresenter />
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
2026-01-02 17:30:30 +08:00
<Style TargetType="ListBox" x:Key="SlotTabGroupListBoxStyle">
2025-12-23 21:35:54 +08:00
<Setter Property="Background" Value="{DynamicResource ControlBackgroundNormalBrush}" />
<Setter Property="BorderThickness" Value="0" />
<Setter Property="assists:ControlAssist.Orientation" Value="Horizontal" />
2025-08-20 12:10:13 +08:00
<Setter Property="assists:ControlAssist.CornerRadius" Value="10" />
<Setter Property="ItemContainerStyle">
<Setter.Value>
<Style TargetType="{x:Type ListBoxItem}">
<Setter Property="Background" Value="Transparent" />
<Setter Property="Foreground" Value="{DynamicResource TextPrimaryBrush}" />
<Setter Property="FontSize" Value="16" />
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ListBoxItem}">
<Grid>
2025-09-04 22:39:00 +08:00
<decorations:EmbossBorder
2025-08-20 12:10:13 +08:00
Background="{TemplateBinding Background}"
CornerRadius="{Binding Path=(assists:ControlAssist.CornerRadius), RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ListBox}}"
Cursor="Hand"
2026-01-02 17:30:30 +08:00
ShaderEnabled="False"
x:Name="emboss">
2025-08-20 12:10:13 +08:00
<ContentPresenter
2025-12-23 21:35:54 +08:00
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
2026-01-02 17:30:30 +08:00
Margin="10"
TextElement.Foreground="{TemplateBinding Foreground}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
2025-09-04 22:39:00 +08:00
</decorations:EmbossBorder>
2025-08-20 12:10:13 +08:00
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsSelected" Value="True">
2026-01-02 17:30:30 +08:00
<Setter Property="ShaderEnabled" TargetName="emboss" Value="True" />
<Setter Property="Background" TargetName="emboss" Value="{DynamicResource ControlBackgroundNormalBrush}" />
2025-08-20 12:10:13 +08:00
<Setter Property="Foreground" Value="{DynamicResource PrimaryNormalBrush}" />
<Trigger.EnterActions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation
2026-01-02 17:30:30 +08:00
Duration="0:0:0.3"
2025-08-20 12:10:13 +08:00
Storyboard.TargetName="emboss"
Storyboard.TargetProperty="Intensity"
2026-01-02 17:30:30 +08:00
To="1" />
2025-08-20 12:10:13 +08:00
</Storyboard>
</BeginStoryboard>
</Trigger.EnterActions>
<Trigger.ExitActions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation
2026-01-02 17:30:30 +08:00
Duration="0:0:0.3"
2025-08-20 12:10:13 +08:00
Storyboard.TargetName="emboss"
Storyboard.TargetProperty="Intensity"
2026-01-02 17:30:30 +08:00
To="0" />
2025-08-20 12:10:13 +08:00
</Storyboard>
</BeginStoryboard>
</Trigger.ExitActions>
</Trigger>
<Trigger Property="IsEnabled" Value="False">
2025-09-12 09:55:36 +08:00
<Setter Property="Foreground" Value="{DynamicResource TextDisabledBrush}" />
</Trigger>
2025-08-20 12:10:13 +08:00
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Setter.Value>
</Setter>
<!-- 设置布局面板为水平排列 -->
<Setter Property="ItemsPanel">
<Setter.Value>
<ItemsPanelTemplate>
2025-12-23 21:35:54 +08:00
<StackPanel Orientation="{Binding Path=(assists:ControlAssist.Orientation), RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ListBox}}" />
2025-08-20 12:10:13 +08:00
</ItemsPanelTemplate>
</Setter.Value>
</Setter>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ListBox">
2025-09-04 22:39:00 +08:00
<decorations:SlotBorder
2025-08-20 12:10:13 +08:00
CornerRadius="{TemplateBinding assists:ControlAssist.CornerRadius}"
2026-01-02 17:30:30 +08:00
Intensity="0.8"
Padding="-4">
2025-08-20 12:10:13 +08:00
<ItemsPresenter />
2025-09-04 22:39:00 +08:00
</decorations:SlotBorder>
2025-08-20 12:10:13 +08:00
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
2026-01-02 17:30:30 +08:00
<Style TargetType="{x:Type ListBoxItem}" x:Key="DefaultListBoxItemStyle">
2025-08-20 12:10:13 +08:00
<Setter Property="SnapsToDevicePixels" Value="True" />
<Setter Property="Padding" Value="10,4" />
2025-12-23 21:35:54 +08:00
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
2025-08-20 12:10:13 +08:00
<Setter Property="VerticalContentAlignment" Value="{Binding VerticalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="BorderBrush" Value="Transparent" />
<Setter Property="BorderThickness" Value="0" />
2025-08-26 21:33:20 +08:00
<Setter Property="FocusVisualStyle" Value="{DynamicResource FocusVisual}" />
2025-08-20 12:10:13 +08:00
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ListBoxItem}">
<Grid>
2025-08-26 21:33:20 +08:00
<!-- 偶数行颜色 -->
<Border
Background="{DynamicResource BackgroundInterlacedBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="4"
IsHitTestVisible="False"
Visibility="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(ItemsControl.AlternationIndex), Converter={x:Static internal:InterlacedBackgroundConverter.Instance}}" />
2025-08-20 12:10:13 +08:00
<Border
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="4"
2026-01-02 17:30:30 +08:00
Padding="{TemplateBinding Padding}"
SnapsToDevicePixels="true"
x:Name="Bd">
2025-08-20 12:10:13 +08:00
<ContentPresenter
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
2026-01-02 17:30:30 +08:00
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
2025-08-20 12:10:13 +08:00
</Border>
</Grid>
<ControlTemplate.Triggers>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsMouseOver" Value="True" />
</MultiTrigger.Conditions>
2026-01-02 17:30:30 +08:00
<Setter Property="Background" TargetName="Bd" Value="{DynamicResource ControlBackgroundHoverBrush}" />
2025-08-20 12:10:13 +08:00
</MultiTrigger>
<!-- 选中对象无焦点 -->
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="Selector.IsSelectionActive" Value="False" />
<Condition Property="IsSelected" Value="True" />
</MultiTrigger.Conditions>
2026-01-02 17:30:30 +08:00
<Setter Property="Background" TargetName="Bd" Value="{DynamicResource PrimaryNormalBrush}" />
<Setter Property="TextElement.Foreground" TargetName="Bd" Value="{DynamicResource TextAccentBrush}" />
2025-08-20 12:10:13 +08:00
</MultiTrigger>
<!-- 选中对象有焦点 -->
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="Selector.IsSelectionActive" Value="True" />
<Condition Property="IsSelected" Value="True" />
</MultiTrigger.Conditions>
2026-01-02 17:30:30 +08:00
<Setter Property="Background" TargetName="Bd" Value="{DynamicResource PrimaryNormalBrush}" />
<Setter Property="TextElement.Foreground" TargetName="Bd" Value="{DynamicResource TextAccentBrush}" />
2025-08-20 12:10:13 +08:00
</MultiTrigger>
<Trigger Property="IsEnabled" Value="False">
2026-01-02 17:30:30 +08:00
<Setter Property="TextElement.Foreground" TargetName="Bd" Value="{DynamicResource TextDisabledBrush}" />
2025-08-20 12:10:13 +08:00
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
2025-09-12 09:55:36 +08:00
2025-10-10 11:19:58 +08:00
<Style BasedOn="{StaticResource DefaultListBoxItemStyle}" TargetType="{x:Type ListBoxItem}" />
2025-08-20 12:10:13 +08:00
2026-01-02 17:30:30 +08:00
<Style TargetType="{x:Type ListBox}" x:Key="DefaultListBoxStyle">
2025-08-26 21:33:20 +08:00
<Setter Property="Background" Value="{DynamicResource ControlBackgroundNormalBrush}" />
2025-08-20 12:10:13 +08:00
<Setter Property="BorderBrush" Value="{DynamicResource BorderNormalBrush}" />
<Setter Property="BorderThickness" Value="1" />
<Setter Property="Foreground" Value="{DynamicResource TextPrimaryBrush}" />
<Setter Property="FontSize" Value="14" />
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto" />
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto" />
<Setter Property="ScrollViewer.CanContentScroll" Value="true" />
<Setter Property="ScrollViewer.PanningMode" Value="Both" />
<Setter Property="Stylus.IsFlicksEnabled" Value="False" />
<Setter Property="VerticalContentAlignment" Value="Center" />
2025-10-10 11:19:58 +08:00
<Setter Property="ItemContainerStyle" Value="{StaticResource DefaultListBoxItemStyle}" />
2025-08-20 12:10:13 +08:00
<Setter Property="AlternationCount" Value="{Binding RelativeSource={RelativeSource Self}, Path=Items.Count}" />
2025-12-23 21:35:54 +08:00
<Setter Property="ItemsPanel">
<Setter.Value>
<ItemsPanelTemplate>
<VirtualizingStackPanel IsItemsHost="True" />
</ItemsPanelTemplate>
</Setter.Value>
</Setter>
2025-08-20 12:10:13 +08:00
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ListBox}">
<Border
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="4"
2026-01-02 17:30:30 +08:00
Padding="2"
SnapsToDevicePixels="true"
x:Name="Bd">
<ScrollViewer Focusable="false" Padding="{TemplateBinding Padding}">
2025-12-23 21:35:54 +08:00
<ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
2025-08-20 12:10:13 +08:00
</ScrollViewer>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsEnabled" Value="false">
2026-01-02 17:30:30 +08:00
<Setter Property="Background" TargetName="Bd" Value="{DynamicResource ControlBackgroundDisabledBrush}" />
2025-08-20 12:10:13 +08:00
</Trigger>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsGrouping" Value="true" />
<Condition Property="VirtualizingPanel.IsVirtualizingWhenGrouping" Value="false" />
</MultiTrigger.Conditions>
<Setter Property="ScrollViewer.CanContentScroll" Value="false" />
</MultiTrigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
2025-12-23 21:35:54 +08:00
<Style.Triggers>
<!-- 3. 新增触发器:当启用流式布局(Wrap)时 -->
<Trigger Property="assists:ControlAssist.IsFlowLayout" Value="True">
<!-- 切换面板为 WrapPanel -->
<Setter Property="ItemsPanel">
<Setter.Value>
<ItemsPanelTemplate>
<WrapPanel IsItemsHost="True" />
</ItemsPanelTemplate>
</Setter.Value>
</Setter>
<!-- 关键WrapPanel 需要禁用水平滚动才能自动换行 -->
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Disabled" />
<!-- 可选:在平铺模式下,通常也希望垂直滚动条按像素滚动而不是按项滚动 -->
<Setter Property="ScrollViewer.CanContentScroll" Value="False" />
</Trigger>
</Style.Triggers>
2025-08-20 12:10:13 +08:00
</Style>
2026-01-02 17:30:30 +08:00
<Style TargetType="{x:Type ListBoxItem}" x:Key="EmbossChipListBoxItemStyle">
2025-09-12 09:55:36 +08:00
<Setter Property="FocusVisualStyle" Value="{DynamicResource FocusVisual}" />
<Setter Property="Background" Value="{DynamicResource ControlBackgroundNormalBrush}" />
<Setter Property="BorderBrush" Value="{DynamicResource BorderNormalBrush}" />
<Setter Property="Foreground" Value="{DynamicResource TextPrimaryBrush}" />
<Setter Property="BorderThickness" Value="0" />
<Setter Property="HorizontalContentAlignment" Value="Center" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="Padding" Value="4,2" />
<Setter Property="Margin" Value="1,2" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ListBoxItem}">
<Grid>
<decorations:EmbossBorder
BorderThickness="{TemplateBinding BorderThickness}"
Intensity="0.6"
2025-12-23 21:35:54 +08:00
Margin="0"
2026-01-02 17:30:30 +08:00
ShaderEnabled="True"
x:Name="emboss" />
<decorations:SlotBorder
2025-09-12 09:55:36 +08:00
Background="{TemplateBinding Background}"
Intensity="0.4"
2026-01-02 17:30:30 +08:00
Margin="0"
ShaderEnabled="False"
x:Name="slot">
2025-09-12 09:55:36 +08:00
<ContentPresenter
2025-12-23 21:35:54 +08:00
Focusable="False"
2026-01-02 17:30:30 +08:00
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
Margin="{TemplateBinding Padding}"
2025-12-23 21:35:54 +08:00
RecognizesAccessKey="True"
2026-01-02 17:30:30 +08:00
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
x:Name="contentPresenter" />
2025-09-12 09:55:36 +08:00
</decorations:SlotBorder>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsSelected" Value="true">
2026-01-02 17:30:30 +08:00
<Setter Property="TextElement.Foreground" TargetName="contentPresenter" Value="{DynamicResource PrimaryGradientBrush}" />
<Setter Property="Visibility" TargetName="emboss" Value="Collapsed" />
<Setter Property="ShaderEnabled" TargetName="slot" Value="True" />
2025-09-12 09:55:36 +08:00
</Trigger>
<Trigger Property="IsEnabled" Value="False">
2026-01-02 17:30:30 +08:00
<Setter Property="Background" TargetName="emboss" Value="{DynamicResource ControlBackgroundDisabledBrush}" />
<Setter Property="Background" TargetName="slot" Value="{DynamicResource ControlBackgroundDisabledBrush}" />
<Setter Property="TextElement.Foreground" TargetName="contentPresenter" Value="{DynamicResource TextDisabledBrush}" />
2025-09-12 09:55:36 +08:00
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
2026-01-02 17:30:30 +08:00
<Style TargetType="{x:Type ListBox}" x:Key="EmbossChipListBoxStyle">
2025-12-23 21:35:54 +08:00
<Setter Property="Background" Value="{DynamicResource BackgroundContainerBrush}" />
2025-09-12 09:55:36 +08:00
<Setter Property="BorderBrush" Value="{DynamicResource BorderNormalBrush}" />
<Setter Property="BorderThickness" Value="1" />
<Setter Property="Foreground" Value="{DynamicResource TextPrimaryBrush}" />
<Setter Property="FontSize" Value="14" />
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Disabled" />
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto" />
<Setter Property="ScrollViewer.CanContentScroll" Value="true" />
<Setter Property="ScrollViewer.PanningMode" Value="Both" />
<Setter Property="Stylus.IsFlicksEnabled" Value="False" />
<Setter Property="VerticalContentAlignment" Value="Center" />
2025-12-28 11:47:54 +08:00
<Setter Property="ItemContainerStyle" Value="{StaticResource EmbossChipListBoxItemStyle}" />
2025-09-12 09:55:36 +08:00
<Setter Property="ItemsPanel">
<Setter.Value>
<ItemsPanelTemplate>
<WrapPanel IsItemsHost="True" />
</ItemsPanelTemplate>
</Setter.Value>
</Setter>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ListBox}">
<decorations:EmbossBorder
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="4"
2026-01-02 17:30:30 +08:00
Padding="2"
SnapsToDevicePixels="true"
x:Name="Bd">
2025-09-12 09:55:36 +08:00
<ScrollViewer
Focusable="false"
2026-01-02 17:30:30 +08:00
HorizontalScrollBarVisibility="Disabled"
Padding="{TemplateBinding Padding}">
2025-09-12 09:55:36 +08:00
<ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
</ScrollViewer>
</decorations:EmbossBorder>
<ControlTemplate.Triggers>
<Trigger Property="IsEnabled" Value="false">
2026-01-02 17:30:30 +08:00
<Setter Property="Background" TargetName="Bd" Value="{DynamicResource ControlBackgroundDisabledBrush}" />
2025-12-23 21:35:54 +08:00
</Trigger>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsGrouping" Value="true" />
<Condition Property="VirtualizingPanel.IsVirtualizingWhenGrouping" Value="false" />
</MultiTrigger.Conditions>
<Setter Property="ScrollViewer.CanContentScroll" Value="false" />
</MultiTrigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
2026-01-02 17:30:30 +08:00
<Style TargetType="{x:Type ListBoxItem}" x:Key="ChipListBoxItemStyle">
2025-12-23 21:35:54 +08:00
<Setter Property="FocusVisualStyle" Value="{DynamicResource FocusVisual}" />
<Setter Property="Background" Value="{DynamicResource ControlBackgroundNormalBrush}" />
<Setter Property="BorderBrush" Value="{DynamicResource BorderNormalBrush}" />
<Setter Property="Foreground" Value="{DynamicResource TextPrimaryBrush}" />
<Setter Property="BorderThickness" Value="0" />
<Setter Property="HorizontalContentAlignment" Value="Center" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="Padding" Value="4" />
<Setter Property="Margin" Value="1,2" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ListBoxItem}">
<Border
Background="{TemplateBinding Background}"
2026-01-02 17:30:30 +08:00
CornerRadius="{TemplateBinding assists:ControlAssist.CornerRadius}"
Padding="{TemplateBinding Padding}"
x:Name="ContentBorder">
2025-12-23 21:35:54 +08:00
<ContentPresenter
Focusable="False"
2026-01-02 17:30:30 +08:00
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
2025-12-23 21:35:54 +08:00
RecognizesAccessKey="True"
2026-01-02 17:30:30 +08:00
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
x:Name="contentPresenter" />
2025-12-23 21:35:54 +08:00
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsSelected" Value="true">
2026-01-02 17:30:30 +08:00
<Setter Property="TextElement.Foreground" TargetName="contentPresenter" Value="{DynamicResource PrimaryNormalBrush}" />
<Setter Property="Background" TargetName="ContentBorder" Value="{DynamicResource ControlBackgroundSelectedBrush}" />
2025-12-23 21:35:54 +08:00
</Trigger>
<Trigger Property="IsMouseOver" Value="true">
2026-01-02 17:30:30 +08:00
<Setter Property="Background" TargetName="ContentBorder" Value="{DynamicResource ControlBackgroundHoverBrush}" />
2025-12-23 21:35:54 +08:00
</Trigger>
<Trigger Property="IsEnabled" Value="False">
2026-01-02 17:30:30 +08:00
<Setter Property="Background" TargetName="ContentBorder" Value="{DynamicResource ControlBackgroundDisabledBrush}" />
<Setter Property="TextElement.Foreground" TargetName="contentPresenter" Value="{DynamicResource TextDisabledBrush}" />
2025-12-23 21:35:54 +08:00
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
2026-01-02 17:30:30 +08:00
<Style TargetType="{x:Type ListBox}" x:Key="ChipListBoxStyle">
2025-12-23 21:35:54 +08:00
<Setter Property="Background" Value="{DynamicResource BackgroundContainerBrush}" />
<Setter Property="BorderBrush" Value="{DynamicResource BorderNormalBrush}" />
<Setter Property="BorderThickness" Value="1" />
<Setter Property="Foreground" Value="{DynamicResource TextPrimaryBrush}" />
<Setter Property="FontSize" Value="14" />
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Disabled" />
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto" />
<Setter Property="ScrollViewer.CanContentScroll" Value="true" />
<Setter Property="ScrollViewer.PanningMode" Value="Both" />
<Setter Property="Stylus.IsFlicksEnabled" Value="False" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="ItemContainerStyle" Value="{StaticResource ChipListBoxItemStyle}" />
<Setter Property="ItemsPanel">
<Setter.Value>
<ItemsPanelTemplate>
<WrapPanel IsItemsHost="True" />
</ItemsPanelTemplate>
</Setter.Value>
</Setter>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ListBox}">
<Border
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="4"
2026-01-02 17:30:30 +08:00
Padding="2"
SnapsToDevicePixels="true"
x:Name="Bd">
2025-12-23 21:35:54 +08:00
<ScrollViewer
Focusable="false"
2026-01-02 17:30:30 +08:00
HorizontalScrollBarVisibility="Disabled"
Padding="{TemplateBinding Padding}">
2025-12-23 21:35:54 +08:00
<ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
</ScrollViewer>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsEnabled" Value="false">
2026-01-02 17:30:30 +08:00
<Setter Property="Background" TargetName="Bd" Value="{DynamicResource ControlBackgroundDisabledBrush}" />
2025-09-12 09:55:36 +08:00
</Trigger>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsGrouping" Value="true" />
<Condition Property="VirtualizingPanel.IsVirtualizingWhenGrouping" Value="false" />
</MultiTrigger.Conditions>
<Setter Property="ScrollViewer.CanContentScroll" Value="false" />
</MultiTrigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
2025-10-10 11:19:58 +08:00
<Style BasedOn="{StaticResource DefaultListBoxStyle}" TargetType="{x:Type ListBox}" />
2025-08-20 12:10:13 +08:00
</ResourceDictionary>