2025-07-16 12:20:02 +08:00
|
|
|
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
2025-07-14 21:08:46 +08:00
|
|
|
|
|
|
|
|
|
2025-07-16 12:20:02 +08:00
|
|
|
<SolidColorBrush x:Key="TextBox.Static.Background" Color="#FFFFFFFF" />
|
|
|
|
|
<SolidColorBrush x:Key="ComboBox.Static.Border" Color="#FFACACAC" />
|
|
|
|
|
<SolidColorBrush x:Key="ComboBox.Static.Glyph" Color="#FF606060" />
|
2025-07-14 21:08:46 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
<Style x:Key="ComboBoxToggleButton" TargetType="{x:Type ToggleButton}">
|
2025-07-16 12:20:02 +08:00
|
|
|
<Setter Property="OverridesDefaultStyle" Value="true" />
|
|
|
|
|
<Setter Property="IsTabStop" Value="false" />
|
|
|
|
|
<Setter Property="Focusable" Value="false" />
|
|
|
|
|
<Setter Property="ClickMode" Value="Press" />
|
2025-07-14 21:08:46 +08:00
|
|
|
<Setter Property="Template">
|
|
|
|
|
<Setter.Value>
|
|
|
|
|
<ControlTemplate TargetType="{x:Type ToggleButton}">
|
2025-07-16 12:20:02 +08:00
|
|
|
<Border
|
|
|
|
|
x:Name="templateRoot"
|
|
|
|
|
Background="{TemplateBinding Background}"
|
|
|
|
|
BorderBrush="#DDDDDD"
|
|
|
|
|
BorderThickness="{TemplateBinding BorderThickness}"
|
|
|
|
|
CornerRadius="3">
|
|
|
|
|
<Border
|
|
|
|
|
x:Name="splitBorder"
|
|
|
|
|
Width="{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}"
|
|
|
|
|
Margin="0"
|
|
|
|
|
HorizontalAlignment="Right"
|
|
|
|
|
BorderBrush="Transparent"
|
|
|
|
|
BorderThickness="1"
|
|
|
|
|
SnapsToDevicePixels="true">
|
|
|
|
|
<Path
|
|
|
|
|
Name="path"
|
|
|
|
|
Width="8"
|
|
|
|
|
HorizontalAlignment="Center"
|
|
|
|
|
VerticalAlignment="Center"
|
|
|
|
|
Data="M0 0 4 4 8 0"
|
|
|
|
|
RenderTransformOrigin="0.5,0.5"
|
|
|
|
|
Stroke="#CCC"
|
|
|
|
|
StrokeThickness="1" />
|
2025-07-14 21:08:46 +08:00
|
|
|
</Border>
|
|
|
|
|
</Border>
|
|
|
|
|
<ControlTemplate.Triggers>
|
|
|
|
|
<Trigger Property="IsMouseOver" Value="true">
|
2025-07-16 12:20:02 +08:00
|
|
|
<Setter TargetName="templateRoot" Property="BorderBrush" Value="green" />
|
2025-07-14 21:08:46 +08:00
|
|
|
</Trigger>
|
|
|
|
|
<Trigger Property="IsKeyboardFocused" Value="true">
|
2025-07-16 12:20:02 +08:00
|
|
|
<Setter TargetName="templateRoot" Property="BorderBrush" Value="green" />
|
2025-07-14 21:08:46 +08:00
|
|
|
</Trigger>
|
|
|
|
|
<Trigger Property="IsChecked" Value="True">
|
|
|
|
|
<Setter TargetName="path" Property="RenderTransform">
|
|
|
|
|
<Setter.Value>
|
2025-07-16 12:20:02 +08:00
|
|
|
<RotateTransform Angle="180" />
|
2025-07-14 21:08:46 +08:00
|
|
|
</Setter.Value>
|
|
|
|
|
</Setter>
|
|
|
|
|
</Trigger>
|
|
|
|
|
</ControlTemplate.Triggers>
|
|
|
|
|
</ControlTemplate>
|
|
|
|
|
</Setter.Value>
|
|
|
|
|
</Setter>
|
|
|
|
|
</Style>
|
|
|
|
|
|
|
|
|
|
<ControlTemplate x:Key="ComboBoxTemplate" TargetType="{x:Type ComboBox}">
|
|
|
|
|
<Grid x:Name="templateRoot" SnapsToDevicePixels="true">
|
|
|
|
|
<Grid.ColumnDefinitions>
|
2025-07-16 12:20:02 +08:00
|
|
|
<ColumnDefinition Width="*" />
|
|
|
|
|
<ColumnDefinition Width="0" MinWidth="{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}" />
|
2025-07-14 21:08:46 +08:00
|
|
|
</Grid.ColumnDefinitions>
|
2025-07-16 12:20:02 +08:00
|
|
|
<Popup
|
|
|
|
|
x:Name="PART_Popup"
|
|
|
|
|
Grid.ColumnSpan="2"
|
|
|
|
|
Margin="1"
|
|
|
|
|
AllowsTransparency="true"
|
|
|
|
|
IsOpen="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
|
|
|
|
|
Placement="Bottom"
|
|
|
|
|
PopupAnimation="{DynamicResource {x:Static SystemParameters.ComboBoxPopupAnimationKey}}"
|
|
|
|
|
VerticalOffset="1">
|
|
|
|
|
<Border
|
|
|
|
|
x:Name="dropDownBorder"
|
|
|
|
|
MinWidth="{Binding ActualWidth, ElementName=templateRoot}"
|
|
|
|
|
MaxHeight="{TemplateBinding MaxDropDownHeight}"
|
|
|
|
|
Background="{DynamicResource {x:Static SystemColors.WindowBrushKey}}"
|
|
|
|
|
BorderBrush="#DDD"
|
|
|
|
|
BorderThickness="1"
|
|
|
|
|
CornerRadius="5">
|
|
|
|
|
<ScrollViewer
|
|
|
|
|
x:Name="DropDownScrollViewer"
|
|
|
|
|
Background="Transparent"
|
|
|
|
|
BorderThickness="0">
|
2025-07-14 21:08:46 +08:00
|
|
|
<Grid x:Name="grid" RenderOptions.ClearTypeHint="Enabled">
|
2025-07-16 12:20:02 +08:00
|
|
|
<Canvas
|
|
|
|
|
x:Name="canvas"
|
|
|
|
|
Width="0"
|
|
|
|
|
Height="0"
|
|
|
|
|
HorizontalAlignment="Left"
|
|
|
|
|
VerticalAlignment="Top">
|
|
|
|
|
<Rectangle
|
|
|
|
|
x:Name="opaqueRect"
|
|
|
|
|
Width="{Binding ActualWidth, ElementName=dropDownBorder}"
|
|
|
|
|
Height="{Binding ActualHeight, ElementName=dropDownBorder}"
|
|
|
|
|
Fill="{Binding Background, ElementName=dropDownBorder}"
|
|
|
|
|
RadiusX="7"
|
|
|
|
|
RadiusY="7" />
|
2025-07-14 21:08:46 +08:00
|
|
|
</Canvas>
|
2025-07-16 12:20:02 +08:00
|
|
|
<ItemsPresenter
|
|
|
|
|
x:Name="ItemsPresenter"
|
|
|
|
|
Margin="3"
|
|
|
|
|
KeyboardNavigation.DirectionalNavigation="Contained"
|
|
|
|
|
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
|
2025-07-14 21:08:46 +08:00
|
|
|
</Grid>
|
|
|
|
|
</ScrollViewer>
|
|
|
|
|
</Border>
|
|
|
|
|
</Popup>
|
2025-07-16 12:20:02 +08:00
|
|
|
<ToggleButton
|
|
|
|
|
x:Name="toggleButton"
|
|
|
|
|
Grid.ColumnSpan="2"
|
|
|
|
|
Background="White"
|
|
|
|
|
BorderBrush="{TemplateBinding BorderBrush}"
|
|
|
|
|
BorderThickness="{TemplateBinding BorderThickness}"
|
|
|
|
|
IsChecked="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
|
|
|
|
|
Style="{StaticResource ComboBoxToggleButton}" />
|
|
|
|
|
<ContentPresenter
|
|
|
|
|
x:Name="contentPresenter"
|
|
|
|
|
Margin="{TemplateBinding Padding}"
|
|
|
|
|
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
|
|
|
|
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
|
|
|
|
Content="{TemplateBinding SelectionBoxItem}"
|
|
|
|
|
ContentStringFormat="{TemplateBinding SelectionBoxItemStringFormat}"
|
|
|
|
|
ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}"
|
|
|
|
|
ContentTemplateSelector="{TemplateBinding ItemTemplateSelector}"
|
|
|
|
|
IsHitTestVisible="false"
|
|
|
|
|
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
|
2025-07-14 21:08:46 +08:00
|
|
|
</Grid>
|
|
|
|
|
<ControlTemplate.Triggers>
|
|
|
|
|
<!--<Trigger Property="HasDropShadow" SourceName="PART_Popup" Value="true">
|
|
|
|
|
<Setter Property="Margin" TargetName="shadow" Value="0,0,5,5"/>
|
|
|
|
|
<Setter Property="Background" TargetName="shadow" Value="#71000000"/>
|
|
|
|
|
</Trigger>-->
|
|
|
|
|
<Trigger Property="HasItems" Value="false">
|
2025-07-16 12:20:02 +08:00
|
|
|
<Setter TargetName="dropDownBorder" Property="Height" Value="95" />
|
2025-07-14 21:08:46 +08:00
|
|
|
</Trigger>
|
|
|
|
|
<MultiTrigger>
|
|
|
|
|
<MultiTrigger.Conditions>
|
2025-07-16 12:20:02 +08:00
|
|
|
<Condition Property="IsGrouping" Value="true" />
|
|
|
|
|
<Condition Property="VirtualizingPanel.IsVirtualizingWhenGrouping" Value="false" />
|
2025-07-14 21:08:46 +08:00
|
|
|
</MultiTrigger.Conditions>
|
2025-07-16 12:20:02 +08:00
|
|
|
<Setter Property="ScrollViewer.CanContentScroll" Value="false" />
|
2025-07-14 21:08:46 +08:00
|
|
|
</MultiTrigger>
|
2025-07-16 12:20:02 +08:00
|
|
|
<Trigger SourceName="DropDownScrollViewer" Property="ScrollViewer.CanContentScroll" Value="false">
|
|
|
|
|
<Setter TargetName="opaqueRect" Property="Canvas.Top" Value="{Binding VerticalOffset, ElementName=DropDownScrollViewer}" />
|
|
|
|
|
<Setter TargetName="opaqueRect" Property="Canvas.Left" Value="{Binding HorizontalOffset, ElementName=DropDownScrollViewer}" />
|
2025-07-14 21:08:46 +08:00
|
|
|
</Trigger>
|
|
|
|
|
</ControlTemplate.Triggers>
|
|
|
|
|
</ControlTemplate>
|
|
|
|
|
|
|
|
|
|
<Style TargetType="{x:Type ComboBox}">
|
2025-07-16 12:20:02 +08:00
|
|
|
<Setter Property="Background" Value="White" />
|
|
|
|
|
<Setter Property="Foreground" Value="#333" />
|
|
|
|
|
<Setter Property="BorderThickness" Value="1" />
|
|
|
|
|
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto" />
|
|
|
|
|
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto" />
|
|
|
|
|
<Setter Property="Padding" Value="6,3,5,3" />
|
|
|
|
|
<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="Template" Value="{StaticResource ComboBoxTemplate}" />
|
2025-07-14 21:08:46 +08:00
|
|
|
</Style>
|
|
|
|
|
|
|
|
|
|
<Style TargetType="ComboBoxItem">
|
2025-07-16 12:20:02 +08:00
|
|
|
<Setter Property="Height" Value="30" />
|
2025-07-14 21:08:46 +08:00
|
|
|
<Setter Property="Template">
|
|
|
|
|
<Setter.Value>
|
|
|
|
|
<ControlTemplate TargetType="ComboBoxItem">
|
2025-07-16 12:20:02 +08:00
|
|
|
<Border
|
|
|
|
|
Name="border"
|
|
|
|
|
Margin="1"
|
|
|
|
|
Background="White"
|
|
|
|
|
BorderBrush="Transparent"
|
|
|
|
|
BorderThickness="1"
|
|
|
|
|
CornerRadius="3">
|
|
|
|
|
<ContentPresenter Margin="3" VerticalAlignment="Center" />
|
2025-07-14 21:08:46 +08:00
|
|
|
</Border>
|
|
|
|
|
<ControlTemplate.Triggers>
|
|
|
|
|
<Trigger Property="IsMouseOver" Value="True">
|
2025-07-16 12:20:02 +08:00
|
|
|
<Setter TargetName="border" Property="Background" Value="#111F71E5" />
|
|
|
|
|
<Setter TargetName="border" Property="BorderBrush" Value="#551F71E5" />
|
2025-07-14 21:08:46 +08:00
|
|
|
</Trigger>
|
|
|
|
|
<Trigger Property="IsSelected" Value="True">
|
2025-07-16 12:20:02 +08:00
|
|
|
<Setter TargetName="border" Property="Background" Value="#1F71E5" />
|
|
|
|
|
<Setter TargetName="border" Property="BorderBrush" Value="#1F71E5" />
|
|
|
|
|
<Setter Property="Foreground" Value="White" />
|
2025-07-14 21:08:46 +08:00
|
|
|
</Trigger>
|
|
|
|
|
</ControlTemplate.Triggers>
|
|
|
|
|
</ControlTemplate>
|
|
|
|
|
</Setter.Value>
|
|
|
|
|
</Setter>
|
|
|
|
|
</Style>
|
|
|
|
|
</ResourceDictionary>
|