Files
ShrlAlgoToolkit/WPFDark/Controls/BiaColorSelector.xaml

110 lines
6.2 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:wpf="clr-namespace:WPFDark"
xmlns:controls="clr-namespace:WPFDark.Controls"
xmlns:converters1="clr-namespace:WPFDark.Controls.Converters">
<Style TargetType="{x:Type controls:BiaColorSelector}">
<Setter Property="BorderColor" Value="{DynamicResource TextBoxBorderColorKey}" />
<Setter Property="Width" Value="36.0" />
<Setter Property="Height" Value="{x:Static wpf:Boxes.BasicOneLineHeight}" />
<Setter Property="CornerRadius" Value="{x:Static wpf:Boxes.BasicCornerRadiusPrim}" />
<Setter Property="Cursor" Value="Hand" />
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="BorderColor" Value="{DynamicResource ButtonActiveBorderBrushKey.IsMouseOver}" />
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="BorderColor" Value="{DynamicResource InactiveBorderColorKey}" />
</Trigger>
</Style.Triggers>
<Style.Resources>
<converters1:DoubleColorToBrushConverter x:Key="ToBrush" />
<DataTemplate DataType="{x:Type wpf:DoubleColor}">
<Grid Width="48" Height="32.0">
<Border Background="{DynamicResource CheckerBrush}" />
<Border Background="{Binding Converter={StaticResource ToBrush}, Mode=OneWay}" />
</Grid>
</DataTemplate>
<Style TargetType="{x:Type ListBox}">
<Setter Property="Background" Value="{DynamicResource PanelBackgroundBrushKey}" />
<Setter Property="BorderBrush" Value="{DynamicResource TextBoxBorderBrushKey}" />
<Setter Property="BorderThickness" Value="1" />
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
<Setter Property="Validation.ErrorTemplate" Value="{x:Null}" />
<Setter Property="ItemsPanel">
<Setter.Value>
<ItemsPanelTemplate>
<UniformGrid Columns="{Binding RelativeSource={RelativeSource AncestorType={x:Type controls:BiaColorSelector}}, Mode=OneWay, Path=Columns}" />
</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="BorderBrush" Value="{DynamicResource TextBoxBorderBrushKey}" />
<Setter Property="BorderThickness" Value="1" />
<Setter Property="HorizontalAlignment" Value="Stretch" />
<Setter Property="VerticalAlignment" Value="Stretch" />
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
<Setter Property="VerticalContentAlignment" Value="Stretch" />
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
<Setter Property="Validation.ErrorTemplate" Value="{x:Null}" />
<Setter Property="Cursor" Value="Hand" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ListBoxItem}">
<Border BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
<ContentPresenter />
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter Property="BorderBrush" Value="GhostWhite" />
</Trigger>
</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 Focusable="False">
<ItemsPresenter Margin="2" />
</ScrollViewer>
</controls:BiaClippingBorder>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Style.Resources>
</Style>
</ResourceDictionary>