Files
Shrlalgo.RvKits/WPFDark/Controls/BiaComboBox.xaml
ShrlAlgo 4d35cadb56 更新
2025-07-11 09:20:23 +08:00

155 lines
9.4 KiB
XML

<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:wpf="clr-namespace:WPFDark"
xmlns:controls="clr-namespace:WPFDark.Controls">
<Style TargetType="{x:Type controls:BiaComboBox}">
<Setter Property="Background" Value="{DynamicResource TextBoxBackgroundBrushKey}" />
<Setter Property="BorderColor" Value="{DynamicResource TextBoxBorderColorKey}" />
<Setter Property="Foreground" Value="{DynamicResource TextBoxForegroundBrushKey}" />
<Setter Property="Height" Value="{x:Static wpf:Boxes.BasicOneLineHeight}" />
<Setter Property="CornerRadius" Value="{x:Static wpf:Boxes.BasicCornerRadiusPrim}" />
<Setter Property="Focusable" Value="True" />
<Setter Property="MarkBrush" Value="{DynamicResource InactiveForegroundBrushKey}" />
<Setter Property="Validation.ErrorTemplate" Value="{x:Null}" />
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="{DynamicResource ActiveBackgroundBrushKey}" />
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Background" Value="{DynamicResource InactiveBackgroundBrushKey}" />
<Setter Property="Foreground" Value="{DynamicResource InactiveForegroundBrushKey}" />
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="MarkBrush" Value="{DynamicResource AccentBrushKey}" />
</Trigger>
<Trigger Property="IsOpen" Value="True">
<Setter Property="MarkBrush" Value="{DynamicResource AccentForegroundBrushKey}" />
<Setter Property="Background" Value="{DynamicResource ActiveBackgroundBrushKey}" />
</Trigger>
</Style.Triggers>
<Style.Resources>
<Style TargetType="{x:Type ListBox}">
<Setter Property="Background" Value="{DynamicResource PanelBackgroundBrushKey}" />
<Setter Property="BorderBrush" Value="{DynamicResource TextBoxBorderBrushKey}" />
<Setter Property="BorderThickness" Value="1" />
<Setter Property="Foreground" Value="{DynamicResource TextBoxForegroundBrushKey}" />
<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" />
<Setter Property="VirtualizingPanel.IsVirtualizing" Value="True" />
<Setter Property="VirtualizingPanel.VirtualizationMode" Value="Recycling" />
<Setter Property="ItemsPanel">
<Setter.Value>
<ItemsPanelTemplate>
<VirtualizingStackPanel CanVerticallyScroll="True" Orientation="Vertical" />
</ItemsPanelTemplate>
</Setter.Value>
</Setter>
<Setter Property="ItemContainerStyle">
<Setter.Value>
<Style TargetType="{x:Type ListBoxItem}">
<Setter Property="SnapsToDevicePixels" Value="True" />
<Setter Property="OverridesDefaultStyle" Value="True" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
<Setter Property="HorizontalAlignment" Value="Stretch" />
<Setter Property="VerticalAlignment" Value="Stretch" />
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
<Setter Property="VerticalContentAlignment" Value="Stretch" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ListBoxItem}">
<Border Padding="1"
Background="{TemplateBinding Background}"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
<ContentPresenter Margin="4,0,0,0" />
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="{DynamicResource SubmenuItemBackgroundHighlighted}" />
</Trigger>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsSelected" Value="True" />
</MultiTrigger.Conditions>
<Setter Property="Background" Value="{DynamicResource Item.SelectedActive.Background}" />
<Setter Property="BorderBrush" Value="{DynamicResource Item.SelectedActive.Border}" />
</MultiTrigger>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsSelected" Value="True" />
<Condition Property="IsMouseOver" Value="True" />
</MultiTrigger.Conditions>
<Setter Property="Background" Value="{DynamicResource Item.SelectedActive.Background.IsMouseOver}" />
<Setter Property="BorderBrush" Value="{DynamicResource Item.SelectedActive.Border.IsMouseOver}" />
</MultiTrigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="IsSelected" Value="True" />
</Trigger>
</Style.Triggers>
</Style>
</Setter.Value>
</Setter>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ListBox}">
<controls:BiaClippingBorder MaxHeight="414"
Background="{DynamicResource SubmenuItemBackground}"
BorderBrush="{DynamicResource MenuItemHighlightedBackground}"
BorderThickness="1"
CornerRadius="{x:Static wpf:Boxes.BasicCornerRadius}">
<ScrollViewer Padding="{TemplateBinding Padding}" Focusable="False">
<ItemsPresenter />
</ScrollViewer>
</controls:BiaClippingBorder>
<ControlTemplate.Triggers>
<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.Triggers>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Background" Value="{DynamicResource InactiveBackgroundBrushKey}" />
<Setter Property="BorderBrush" Value="{DynamicResource InactiveBorderBrushKey}" />
<Setter Property="Foreground" Value="{DynamicResource InactiveForegroundBrushKey}" />
</Trigger>
<Trigger Property="HasItems" Value="False">
<Setter Property="MinHeight" Value="100" />
</Trigger>
</Style.Triggers>
</Style>
</Style.Resources>
</Style>
</ResourceDictionary>