2025-07-31 20:12:01 +08:00
|
|
|
|
<ResourceDictionary
|
|
|
|
|
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
2026-02-12 21:29:00 +08:00
|
|
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
2026-01-02 17:30:41 +08:00
|
|
|
|
xmlns:assists="clr-namespace:Melskin.Assists"
|
|
|
|
|
|
xmlns:controls="clr-namespace:Melskin.Controls"
|
|
|
|
|
|
xmlns:converters="clr-namespace:Melskin.Converters"
|
2026-02-12 21:29:00 +08:00
|
|
|
|
xmlns:decorations="clr-namespace:Melskin.Controls.Decorations">
|
2025-07-31 20:12:24 +08:00
|
|
|
|
<ResourceDictionary.MergedDictionaries>
|
|
|
|
|
|
<ResourceDictionary Source="FlattenTextBox.xaml" />
|
2026-01-02 17:30:41 +08:00
|
|
|
|
<ResourceDictionary Source="/Melskin;component/Themes/Animations.xaml" />
|
2025-07-31 20:12:24 +08:00
|
|
|
|
</ResourceDictionary.MergedDictionaries>
|
2025-12-23 21:35:54 +08:00
|
|
|
|
<!--#region 动画-->
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<!-- 按钮高亮 -->
|
2025-07-11 09:20:23 +08:00
|
|
|
|
<Storyboard x:Key="Button.FocusEffect">
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<DoubleAnimation
|
|
|
|
|
|
Storyboard.TargetName="border"
|
|
|
|
|
|
Storyboard.TargetProperty="Intensity"
|
2026-02-12 21:29:00 +08:00
|
|
|
|
To="0.8"
|
|
|
|
|
|
Duration="0:0:0.2" />
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<BooleanAnimationUsingKeyFrames
|
|
|
|
|
|
Storyboard.TargetName="border"
|
2026-02-12 21:29:00 +08:00
|
|
|
|
Storyboard.TargetProperty="ShaderEnabled"
|
|
|
|
|
|
Duration="0">
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<DiscreteBooleanKeyFrame KeyTime="0" Value="True" />
|
2025-07-11 09:20:23 +08:00
|
|
|
|
</BooleanAnimationUsingKeyFrames>
|
|
|
|
|
|
</Storyboard>
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<!-- 按钮取消高亮 -->
|
2025-07-11 09:20:23 +08:00
|
|
|
|
<Storyboard x:Key="Button.LeaveEffect">
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<DoubleAnimation
|
|
|
|
|
|
Storyboard.TargetName="border"
|
|
|
|
|
|
Storyboard.TargetProperty="Intensity"
|
2026-02-12 21:29:00 +08:00
|
|
|
|
To="0"
|
|
|
|
|
|
Duration="0:0:0.2" />
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<BooleanAnimationUsingKeyFrames
|
|
|
|
|
|
Storyboard.TargetName="border"
|
2026-02-12 21:29:00 +08:00
|
|
|
|
Storyboard.TargetProperty="ShaderEnabled"
|
|
|
|
|
|
Duration="0:0:0.2">
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<DiscreteBooleanKeyFrame KeyTime="0:0:0.2" Value="False" />
|
2025-07-11 09:20:23 +08:00
|
|
|
|
</BooleanAnimationUsingKeyFrames>
|
|
|
|
|
|
</Storyboard>
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<!-- 按钮按下 -->
|
2025-07-11 09:20:23 +08:00
|
|
|
|
<Storyboard x:Key="Button.PressEffect">
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<DoubleAnimation
|
|
|
|
|
|
Storyboard.TargetName="border"
|
|
|
|
|
|
Storyboard.TargetProperty="Intensity"
|
2026-02-12 21:29:00 +08:00
|
|
|
|
To="0.4"
|
|
|
|
|
|
Duration="0" />
|
2025-07-11 09:20:23 +08:00
|
|
|
|
</Storyboard>
|
2025-12-23 21:35:54 +08:00
|
|
|
|
<!--#endregion-->
|
|
|
|
|
|
<!-- 内容样式 -->
|
|
|
|
|
|
<Style TargetType="{x:Type ComboBoxItem}">
|
|
|
|
|
|
<Setter Property="SnapsToDevicePixels" Value="True" />
|
|
|
|
|
|
<Setter Property="Padding" Value="12,4,8,4" />
|
|
|
|
|
|
<Setter Property="HorizontalContentAlignment" Value="{Binding HorizontalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}" />
|
|
|
|
|
|
<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="1" />
|
|
|
|
|
|
<Setter Property="FocusVisualStyle" Value="{DynamicResource FocusVisual}" />
|
|
|
|
|
|
<Setter Property="Template">
|
|
|
|
|
|
<Setter.Value>
|
|
|
|
|
|
<ControlTemplate TargetType="{x:Type ComboBoxItem}">
|
|
|
|
|
|
<Grid Margin="0,1">
|
|
|
|
|
|
<Border
|
2026-02-12 21:29:00 +08:00
|
|
|
|
x:Name="Bd"
|
|
|
|
|
|
Padding="{TemplateBinding Padding}"
|
2025-12-23 21:35:54 +08:00
|
|
|
|
Background="{TemplateBinding Background}"
|
|
|
|
|
|
BorderBrush="{TemplateBinding BorderBrush}"
|
|
|
|
|
|
BorderThickness="{TemplateBinding BorderThickness}"
|
|
|
|
|
|
CornerRadius="4"
|
2026-02-12 21:29:00 +08:00
|
|
|
|
SnapsToDevicePixels="True">
|
2025-12-23 21:35:54 +08:00
|
|
|
|
<ContentPresenter
|
|
|
|
|
|
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
2026-02-12 21:29:00 +08:00
|
|
|
|
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
|
|
|
|
|
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
|
2025-12-23 21:35:54 +08:00
|
|
|
|
</Border>
|
|
|
|
|
|
<!-- 选中标记 -->
|
|
|
|
|
|
<Border
|
2026-02-12 21:29:00 +08:00
|
|
|
|
x:Name="Indicator"
|
2025-12-23 21:35:54 +08:00
|
|
|
|
CornerRadius="4"
|
2026-02-12 21:29:00 +08:00
|
|
|
|
Visibility="Hidden">
|
2025-12-23 21:35:54 +08:00
|
|
|
|
<Border
|
2026-02-12 21:29:00 +08:00
|
|
|
|
Width="4"
|
2026-01-02 17:30:30 +08:00
|
|
|
|
Margin="2,4"
|
2026-02-12 21:29:00 +08:00
|
|
|
|
HorizontalAlignment="Left"
|
|
|
|
|
|
Background="{DynamicResource PrimaryNormalBrush}"
|
|
|
|
|
|
CornerRadius="2" />
|
2025-12-23 21:35:54 +08:00
|
|
|
|
</Border>
|
|
|
|
|
|
</Grid>
|
|
|
|
|
|
|
|
|
|
|
|
<ControlTemplate.Triggers>
|
|
|
|
|
|
<Trigger Property="IsEnabled" Value="False">
|
2026-02-12 21:29:00 +08:00
|
|
|
|
<Setter TargetName="Bd" Property="TextElement.Foreground" Value="{DynamicResource TextDisabledBrush}" />
|
2025-12-23 21:35:54 +08:00
|
|
|
|
</Trigger>
|
|
|
|
|
|
<Trigger Property="IsSelected" Value="True">
|
2026-02-12 21:29:00 +08:00
|
|
|
|
<Setter TargetName="Indicator" Property="Visibility" Value="Visible" />
|
2025-12-23 21:35:54 +08:00
|
|
|
|
</Trigger>
|
|
|
|
|
|
<Trigger Property="IsMouseOver" Value="True">
|
2026-02-12 21:29:00 +08:00
|
|
|
|
<Setter TargetName="Bd" Property="Background" Value="{DynamicResource ControlBackgroundHoverBrush}" />
|
2025-12-23 21:35:54 +08:00
|
|
|
|
</Trigger>
|
|
|
|
|
|
<!--<Trigger Property="IsKeyboardFocused" Value="True">
|
|
|
|
|
|
<Setter TargetName="Bd" Property="BorderBrush" Value="{DynamicResource PrimaryFocusedBrush}" />
|
|
|
|
|
|
</Trigger>-->
|
|
|
|
|
|
</ControlTemplate.Triggers>
|
|
|
|
|
|
</ControlTemplate>
|
|
|
|
|
|
</Setter.Value>
|
|
|
|
|
|
</Setter>
|
|
|
|
|
|
</Style>
|
|
|
|
|
|
<!--#region FloatStyle-->
|
2025-07-11 09:20:23 +08:00
|
|
|
|
|
2026-02-12 21:29:00 +08:00
|
|
|
|
<Style x:Key="FloatComboBoxToggleButton" TargetType="{x:Type ToggleButton}">
|
2025-08-20 12:10:13 +08:00
|
|
|
|
<Setter Property="OverridesDefaultStyle" Value="True" />
|
|
|
|
|
|
<Setter Property="IsTabStop" Value="False" />
|
|
|
|
|
|
<Setter Property="Focusable" Value="False" />
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<Setter Property="ClickMode" Value="Press" />
|
2025-07-11 09:20:23 +08:00
|
|
|
|
<Setter Property="Template">
|
|
|
|
|
|
<Setter.Value>
|
|
|
|
|
|
<ControlTemplate TargetType="{x:Type ToggleButton}">
|
2025-09-04 22:39:00 +08:00
|
|
|
|
<decorations:EmbossBorder
|
2026-02-12 21:29:00 +08:00
|
|
|
|
x:Name="border"
|
2025-07-31 20:12:01 +08:00
|
|
|
|
Background="{TemplateBinding Background}"
|
|
|
|
|
|
BorderBrush="{TemplateBinding BorderBrush}"
|
|
|
|
|
|
BorderThickness="{TemplateBinding BorderThickness}"
|
|
|
|
|
|
CornerRadius="4"
|
|
|
|
|
|
Intensity="0"
|
|
|
|
|
|
ShaderEnabled="False"
|
2026-02-12 21:29:00 +08:00
|
|
|
|
SnapsToDevicePixels="True">
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<!-- 下拉箭头 -->
|
|
|
|
|
|
<Border
|
2026-02-12 21:29:00 +08:00
|
|
|
|
x:Name="splitBorder"
|
|
|
|
|
|
Width="{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}"
|
|
|
|
|
|
Margin="0"
|
|
|
|
|
|
HorizontalAlignment="Right"
|
2025-07-31 20:12:01 +08:00
|
|
|
|
BorderBrush="Transparent"
|
|
|
|
|
|
BorderThickness="1"
|
2026-02-12 21:29:00 +08:00
|
|
|
|
SnapsToDevicePixels="True">
|
2025-09-08 19:49:09 +08:00
|
|
|
|
<controls:IconElement
|
2026-02-12 21:29:00 +08:00
|
|
|
|
x:Name="arrow"
|
2025-09-08 19:49:09 +08:00
|
|
|
|
Foreground="{DynamicResource TextPrimaryBrush}"
|
2025-09-06 00:36:23 +08:00
|
|
|
|
RenderTransformOrigin="0.5,0.5"
|
2025-09-08 19:49:09 +08:00
|
|
|
|
SnapsToDevicePixels="false"
|
2026-02-12 21:29:00 +08:00
|
|
|
|
Symbol="KeyboardArrowDown">
|
2025-09-08 19:49:09 +08:00
|
|
|
|
<controls:IconElement.RenderTransform>
|
2025-09-04 22:39:00 +08:00
|
|
|
|
<RotateTransform Angle="0" />
|
2025-09-08 19:49:09 +08:00
|
|
|
|
</controls:IconElement.RenderTransform>
|
|
|
|
|
|
</controls:IconElement>
|
2025-07-11 09:20:23 +08:00
|
|
|
|
</Border>
|
2025-09-04 22:39:00 +08:00
|
|
|
|
</decorations:EmbossBorder>
|
2025-07-11 09:20:23 +08:00
|
|
|
|
<ControlTemplate.Triggers>
|
2025-08-20 12:10:13 +08:00
|
|
|
|
<Trigger Property="IsMouseOver" Value="True">
|
2026-02-12 21:29:00 +08:00
|
|
|
|
<Setter TargetName="border" Property="BorderBrush" Value="{DynamicResource BorderGradientBrush}" />
|
2025-07-11 09:20:23 +08:00
|
|
|
|
<Trigger.EnterActions>
|
2025-09-08 19:49:09 +08:00
|
|
|
|
<BeginStoryboard Storyboard="{StaticResource Button.FocusEffect}" />
|
2025-07-11 09:20:23 +08:00
|
|
|
|
</Trigger.EnterActions>
|
|
|
|
|
|
<Trigger.ExitActions>
|
|
|
|
|
|
<BeginStoryboard Storyboard="{StaticResource Button.LeaveEffect}" />
|
|
|
|
|
|
</Trigger.ExitActions>
|
|
|
|
|
|
</Trigger>
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<!-- 缩减阴影,下压效果 -->
|
2025-08-20 12:10:13 +08:00
|
|
|
|
<Trigger Property="IsPressed" Value="True">
|
2025-07-11 09:20:23 +08:00
|
|
|
|
<Trigger.EnterActions>
|
2026-02-12 21:29:00 +08:00
|
|
|
|
<BeginStoryboard x:Name="pressBegin" Storyboard="{StaticResource Button.PressEffect}" />
|
2025-07-11 09:20:23 +08:00
|
|
|
|
</Trigger.EnterActions>
|
|
|
|
|
|
<Trigger.ExitActions>
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<RemoveStoryboard BeginStoryboardName="pressBegin" />
|
2025-07-11 09:20:23 +08:00
|
|
|
|
</Trigger.ExitActions>
|
|
|
|
|
|
</Trigger>
|
|
|
|
|
|
<Trigger Property="IsChecked" Value="True">
|
2026-02-12 21:29:00 +08:00
|
|
|
|
<Setter TargetName="border" Property="BorderBrush" Value="{DynamicResource BorderGradientBrush}" />
|
2025-09-08 19:49:09 +08:00
|
|
|
|
<Trigger.EnterActions>
|
|
|
|
|
|
<BeginStoryboard Storyboard="{StaticResource ExpandRotateStoryboard}" />
|
|
|
|
|
|
</Trigger.EnterActions>
|
|
|
|
|
|
<Trigger.ExitActions>
|
|
|
|
|
|
<BeginStoryboard Storyboard="{StaticResource CollapseRotateStoryboard}" />
|
|
|
|
|
|
</Trigger.ExitActions>
|
2025-07-11 09:20:23 +08:00
|
|
|
|
</Trigger>
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<!-- 按钮禁用效果 -->
|
2025-08-20 12:10:13 +08:00
|
|
|
|
<Trigger Property="IsEnabled" Value="False">
|
2026-02-12 21:29:00 +08:00
|
|
|
|
<Setter TargetName="arrow" Property="Foreground" Value="{DynamicResource TextDisabledBrush}" />
|
|
|
|
|
|
<Setter TargetName="border" Property="Background" Value="{DynamicResource ControlBackgroundDisabledBrush}" />
|
2025-09-06 00:36:23 +08:00
|
|
|
|
</Trigger>
|
|
|
|
|
|
</ControlTemplate.Triggers>
|
|
|
|
|
|
</ControlTemplate>
|
|
|
|
|
|
</Setter.Value>
|
|
|
|
|
|
</Setter>
|
|
|
|
|
|
</Style>
|
2025-08-20 12:10:35 +08:00
|
|
|
|
<!-- 可编辑模板 -->
|
2026-02-12 21:29:00 +08:00
|
|
|
|
<ControlTemplate x:Key="FloatComboBoxEditableTemplate" TargetType="{x:Type ComboBox}">
|
|
|
|
|
|
<Grid x:Name="templateRoot" SnapsToDevicePixels="True">
|
2025-07-11 09:20:23 +08:00
|
|
|
|
<Grid.ColumnDefinitions>
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<ColumnDefinition Width="*" />
|
2026-02-12 21:29:00 +08:00
|
|
|
|
<ColumnDefinition Width="0" MinWidth="{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}" />
|
2025-07-11 09:20:23 +08:00
|
|
|
|
</Grid.ColumnDefinitions>
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<Popup
|
2026-02-12 21:29:00 +08:00
|
|
|
|
x:Name="PART_Popup"
|
2026-01-02 17:30:30 +08:00
|
|
|
|
Grid.ColumnSpan="2"
|
|
|
|
|
|
Margin="-8"
|
2026-02-12 21:29:00 +08:00
|
|
|
|
AllowsTransparency="True"
|
|
|
|
|
|
IsOpen="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
|
2025-07-31 20:12:01 +08:00
|
|
|
|
Placement="Bottom"
|
|
|
|
|
|
PopupAnimation="Slide"
|
2026-02-12 21:29:00 +08:00
|
|
|
|
VerticalOffset="4">
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<Border
|
2026-02-12 21:29:00 +08:00
|
|
|
|
x:Name="dropDownBorder"
|
|
|
|
|
|
MinWidth="{Binding ActualWidth, ElementName=templateRoot}"
|
|
|
|
|
|
MaxHeight="{TemplateBinding MaxDropDownHeight}"
|
|
|
|
|
|
Margin="8"
|
2025-09-06 00:36:23 +08:00
|
|
|
|
Background="{DynamicResource BackgroundFloatingBrush}"
|
2025-08-12 23:08:54 +08:00
|
|
|
|
BorderBrush="{DynamicResource BorderNormalBrush}"
|
2025-07-31 20:12:01 +08:00
|
|
|
|
BorderThickness="1"
|
2026-02-12 21:29:00 +08:00
|
|
|
|
CornerRadius="4">
|
|
|
|
|
|
<ScrollViewer x:Name="DropDownScrollViewer" Margin="4,3">
|
|
|
|
|
|
<Grid x:Name="grid" RenderOptions.ClearTypeHint="Enabled">
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<Canvas
|
2026-02-12 21:29:00 +08:00
|
|
|
|
x:Name="canvas"
|
|
|
|
|
|
Width="0"
|
2025-07-31 20:12:01 +08:00
|
|
|
|
Height="0"
|
|
|
|
|
|
HorizontalAlignment="Left"
|
2026-02-12 21:29:00 +08:00
|
|
|
|
VerticalAlignment="Top">
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<Rectangle
|
2026-02-12 21:29:00 +08:00
|
|
|
|
x:Name="opaqueRect"
|
2026-01-02 17:30:30 +08:00
|
|
|
|
Width="{Binding ActualWidth, ElementName=dropDownBorder}"
|
2026-02-12 21:29:00 +08:00
|
|
|
|
Height="{Binding ActualHeight, ElementName=dropDownBorder}"
|
|
|
|
|
|
Fill="{Binding Background, ElementName=dropDownBorder}" />
|
2025-07-11 09:20:23 +08:00
|
|
|
|
</Canvas>
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<ItemsPresenter
|
2026-02-12 21:29:00 +08:00
|
|
|
|
x:Name="ItemsPresenter"
|
2025-07-31 20:12:01 +08:00
|
|
|
|
KeyboardNavigation.DirectionalNavigation="Contained"
|
2026-02-12 21:29:00 +08:00
|
|
|
|
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
|
2025-07-11 09:20:23 +08:00
|
|
|
|
</Grid>
|
|
|
|
|
|
</ScrollViewer>
|
|
|
|
|
|
</Border>
|
|
|
|
|
|
</Popup>
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<ToggleButton
|
2026-02-12 21:29:00 +08:00
|
|
|
|
x:Name="toggleButton"
|
|
|
|
|
|
Grid.Column="0"
|
|
|
|
|
|
Grid.ColumnSpan="2"
|
|
|
|
|
|
Margin="-4"
|
2025-07-31 20:12:01 +08:00
|
|
|
|
Background="{TemplateBinding Background}"
|
|
|
|
|
|
BorderBrush="{TemplateBinding BorderBrush}"
|
|
|
|
|
|
BorderThickness="{TemplateBinding BorderThickness}"
|
|
|
|
|
|
IsChecked="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
|
2026-02-12 21:29:00 +08:00
|
|
|
|
Style="{StaticResource FloatComboBoxToggleButton}" />
|
2025-09-06 00:36:23 +08:00
|
|
|
|
<!-- 输入框 -->
|
2025-12-23 21:35:54 +08:00
|
|
|
|
<TextBox
|
2026-02-12 21:29:00 +08:00
|
|
|
|
x:Name="PART_EditableTextBox"
|
2025-07-31 20:12:01 +08:00
|
|
|
|
Grid.Column="0"
|
2025-10-10 11:19:58 +08:00
|
|
|
|
Margin="{TemplateBinding BorderThickness}"
|
2025-12-23 21:35:54 +08:00
|
|
|
|
Padding="{TemplateBinding Padding}"
|
2026-02-12 21:29:00 +08:00
|
|
|
|
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
|
2025-12-23 21:35:54 +08:00
|
|
|
|
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
|
2026-02-12 21:29:00 +08:00
|
|
|
|
Background="Transparent"
|
|
|
|
|
|
IsReadOnly="{Binding IsReadOnly, RelativeSource={RelativeSource TemplatedParent}}"
|
|
|
|
|
|
Style="{StaticResource FlattenTextBoxStyle}" />
|
2025-09-06 00:36:23 +08:00
|
|
|
|
<!-- 水印 -->
|
2025-08-20 12:10:35 +08:00
|
|
|
|
<TextBlock
|
2026-02-12 21:29:00 +08:00
|
|
|
|
x:Name="Placeholder"
|
2025-10-10 11:19:58 +08:00
|
|
|
|
Grid.Column="0"
|
2025-08-20 12:10:35 +08:00
|
|
|
|
Margin="{TemplateBinding Padding}"
|
2025-12-23 21:35:54 +08:00
|
|
|
|
Padding="4"
|
2025-08-20 12:10:35 +08:00
|
|
|
|
VerticalAlignment="Center"
|
2026-02-12 21:29:00 +08:00
|
|
|
|
Foreground="{DynamicResource TextPlaceholderBrush}"
|
|
|
|
|
|
IsHitTestVisible="False"
|
|
|
|
|
|
Text="{Binding Path=(assists:InputAssist.PlaceholderText), RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ComboBox}}">
|
2025-08-20 12:10:35 +08:00
|
|
|
|
<TextBlock.Style>
|
|
|
|
|
|
<Style TargetType="TextBlock">
|
|
|
|
|
|
<Setter Property="Visibility" Value="Collapsed" />
|
|
|
|
|
|
<Style.Triggers>
|
|
|
|
|
|
<DataTrigger Binding="{Binding SelectedItem, RelativeSource={RelativeSource AncestorType=ComboBox}}" Value="{x:Null}">
|
|
|
|
|
|
<Setter Property="Visibility" Value="Visible" />
|
|
|
|
|
|
</DataTrigger>
|
2025-10-04 08:52:23 +08:00
|
|
|
|
<!-- 后台给文本赋值时触发 -->
|
|
|
|
|
|
<DataTrigger Binding="{Binding Text, RelativeSource={RelativeSource AncestorType=ComboBox}, Converter={x:Static converters:NullOrEmptyConverter.Instance}}" Value="False">
|
|
|
|
|
|
<Setter Property="Visibility" Value="Collapsed" />
|
|
|
|
|
|
</DataTrigger>
|
2025-08-20 12:10:35 +08:00
|
|
|
|
</Style.Triggers>
|
|
|
|
|
|
</Style>
|
|
|
|
|
|
</TextBlock.Style>
|
|
|
|
|
|
</TextBlock>
|
2025-07-11 09:20:23 +08:00
|
|
|
|
</Grid>
|
|
|
|
|
|
<ControlTemplate.Triggers>
|
2025-12-23 21:35:54 +08:00
|
|
|
|
<!--<Trigger Property="IsEnabled" Value="False">
|
|
|
|
|
|
<Setter TargetName="border" Property="Opacity" Value="0.56" />
|
|
|
|
|
|
</Trigger>-->
|
2025-08-20 12:10:13 +08:00
|
|
|
|
<Trigger Property="IsEnabled" Value="False">
|
2026-02-12 21:29:00 +08:00
|
|
|
|
<Setter TargetName="PART_EditableTextBox" Property="Foreground" Value="{DynamicResource TextDisabledBrush}" />
|
2025-07-11 09:20:23 +08:00
|
|
|
|
</Trigger>
|
2025-08-20 12:10:13 +08:00
|
|
|
|
<Trigger Property="IsKeyboardFocusWithin" Value="True" />
|
2026-02-12 21:29:00 +08:00
|
|
|
|
<Trigger SourceName="PART_Popup" Property="HasDropShadow" Value="True">
|
|
|
|
|
|
<Setter TargetName="dropDownBorder" Property="Effect" Value="{DynamicResource PopupShadow}" />
|
2025-07-11 09:20:23 +08:00
|
|
|
|
</Trigger>
|
2025-08-20 12:10:13 +08:00
|
|
|
|
<Trigger Property="HasItems" Value="False">
|
2026-02-12 21:29:00 +08:00
|
|
|
|
<Setter TargetName="dropDownBorder" Property="Height" Value="95" />
|
2025-07-11 09:20:23 +08:00
|
|
|
|
</Trigger>
|
|
|
|
|
|
<MultiTrigger>
|
|
|
|
|
|
<MultiTrigger.Conditions>
|
2025-08-20 12:10:13 +08:00
|
|
|
|
<Condition Property="IsGrouping" Value="True" />
|
|
|
|
|
|
<Condition Property="VirtualizingPanel.IsVirtualizingWhenGrouping" Value="False" />
|
2025-07-11 09:20:23 +08:00
|
|
|
|
</MultiTrigger.Conditions>
|
2025-08-20 12:10:13 +08:00
|
|
|
|
<Setter Property="ScrollViewer.CanContentScroll" Value="False" />
|
2025-07-11 09:20:23 +08:00
|
|
|
|
</MultiTrigger>
|
2026-02-12 21:29:00 +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-11 09:20:23 +08:00
|
|
|
|
</Trigger>
|
|
|
|
|
|
</ControlTemplate.Triggers>
|
|
|
|
|
|
</ControlTemplate>
|
|
|
|
|
|
|
2026-02-12 21:29:00 +08:00
|
|
|
|
<ControlTemplate x:Key="FloatComboBoxTemplate" TargetType="{x:Type ComboBox}">
|
|
|
|
|
|
<Grid x:Name="templateRoot" SnapsToDevicePixels="True">
|
2025-07-11 09:20:23 +08:00
|
|
|
|
<Grid.ColumnDefinitions>
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<ColumnDefinition Width="*" />
|
2026-02-12 21:29:00 +08:00
|
|
|
|
<ColumnDefinition Width="0" MinWidth="{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}" />
|
2025-07-11 09:20:23 +08:00
|
|
|
|
</Grid.ColumnDefinitions>
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<Popup
|
2026-02-12 21:29:00 +08:00
|
|
|
|
x:Name="PART_Popup"
|
2026-01-02 17:30:30 +08:00
|
|
|
|
Grid.ColumnSpan="2"
|
|
|
|
|
|
Margin="-8"
|
2026-02-12 21:29:00 +08:00
|
|
|
|
AllowsTransparency="True"
|
|
|
|
|
|
IsOpen="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
|
2025-07-31 20:12:01 +08:00
|
|
|
|
Placement="Bottom"
|
|
|
|
|
|
PopupAnimation="Slide"
|
2026-02-12 21:29:00 +08:00
|
|
|
|
VerticalOffset="4">
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<Border
|
2026-02-12 21:29:00 +08:00
|
|
|
|
x:Name="dropDownBorder"
|
|
|
|
|
|
MinWidth="{Binding ActualWidth, ElementName=templateRoot}"
|
|
|
|
|
|
MaxHeight="{TemplateBinding MaxDropDownHeight}"
|
|
|
|
|
|
Margin="8"
|
2025-09-06 00:36:23 +08:00
|
|
|
|
Background="{DynamicResource BackgroundFloatingBrush}"
|
2025-08-12 23:08:54 +08:00
|
|
|
|
BorderBrush="{DynamicResource BorderNormalBrush}"
|
2025-07-31 20:12:01 +08:00
|
|
|
|
BorderThickness="1"
|
2026-02-12 21:29:00 +08:00
|
|
|
|
CornerRadius="4">
|
|
|
|
|
|
<ScrollViewer x:Name="DropDownScrollViewer" Margin="4,3">
|
|
|
|
|
|
<Grid x:Name="grid" RenderOptions.ClearTypeHint="Enabled">
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<Canvas
|
2026-02-12 21:29:00 +08:00
|
|
|
|
x:Name="canvas"
|
|
|
|
|
|
Width="0"
|
2025-07-31 20:12:01 +08:00
|
|
|
|
Height="0"
|
|
|
|
|
|
HorizontalAlignment="Left"
|
2026-02-12 21:29:00 +08:00
|
|
|
|
VerticalAlignment="Top">
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<Rectangle
|
2026-02-12 21:29:00 +08:00
|
|
|
|
x:Name="opaqueRect"
|
2026-01-02 17:30:30 +08:00
|
|
|
|
Width="{Binding ActualWidth, ElementName=dropDownBorder}"
|
2026-02-12 21:29:00 +08:00
|
|
|
|
Height="{Binding ActualHeight, ElementName=dropDownBorder}"
|
|
|
|
|
|
Fill="{Binding Background, ElementName=dropDownBorder}" />
|
2025-07-11 09:20:23 +08:00
|
|
|
|
</Canvas>
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<ItemsPresenter
|
2026-02-12 21:29:00 +08:00
|
|
|
|
x:Name="ItemsPresenter"
|
2025-07-31 20:12:01 +08:00
|
|
|
|
KeyboardNavigation.DirectionalNavigation="Contained"
|
2026-02-12 21:29:00 +08:00
|
|
|
|
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
|
2025-07-11 09:20:23 +08:00
|
|
|
|
</Grid>
|
|
|
|
|
|
</ScrollViewer>
|
|
|
|
|
|
</Border>
|
|
|
|
|
|
</Popup>
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<ToggleButton
|
2026-02-12 21:29:00 +08:00
|
|
|
|
x:Name="toggleButton"
|
|
|
|
|
|
Grid.Column="0"
|
|
|
|
|
|
Grid.ColumnSpan="2"
|
2025-07-31 20:12:01 +08:00
|
|
|
|
Background="{TemplateBinding Background}"
|
|
|
|
|
|
BorderBrush="{TemplateBinding BorderBrush}"
|
|
|
|
|
|
BorderThickness="{TemplateBinding BorderThickness}"
|
|
|
|
|
|
IsChecked="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
|
2026-02-12 21:29:00 +08:00
|
|
|
|
Style="{StaticResource FloatComboBoxToggleButton}" />
|
2025-08-20 12:10:35 +08:00
|
|
|
|
<TextBlock
|
2026-02-12 21:29:00 +08:00
|
|
|
|
x:Name="Placeholder"
|
2025-10-10 11:19:58 +08:00
|
|
|
|
Grid.Column="0"
|
|
|
|
|
|
Margin="{TemplateBinding Padding}"
|
2025-12-23 21:35:54 +08:00
|
|
|
|
Padding="3"
|
2025-10-10 11:19:58 +08:00
|
|
|
|
VerticalAlignment="Center"
|
2026-02-12 21:29:00 +08:00
|
|
|
|
Foreground="{DynamicResource TextPlaceholderBrush}"
|
|
|
|
|
|
IsHitTestVisible="False"
|
|
|
|
|
|
Text="{Binding Path=(assists:InputAssist.PlaceholderText), RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ComboBox}}">
|
2025-08-20 12:10:35 +08:00
|
|
|
|
<TextBlock.Style>
|
|
|
|
|
|
<Style TargetType="TextBlock">
|
|
|
|
|
|
<Setter Property="Visibility" Value="Collapsed" />
|
|
|
|
|
|
<Style.Triggers>
|
|
|
|
|
|
<DataTrigger Binding="{Binding SelectedItem, RelativeSource={RelativeSource AncestorType=ComboBox}}" Value="{x:Null}">
|
|
|
|
|
|
<Setter Property="Visibility" Value="Visible" />
|
|
|
|
|
|
</DataTrigger>
|
|
|
|
|
|
</Style.Triggers>
|
|
|
|
|
|
</Style>
|
|
|
|
|
|
</TextBlock.Style>
|
|
|
|
|
|
</TextBlock>
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<ContentPresenter
|
2026-02-12 21:29:00 +08:00
|
|
|
|
x:Name="contentPresenter"
|
|
|
|
|
|
Grid.Column="0"
|
|
|
|
|
|
Margin="{TemplateBinding Padding}"
|
|
|
|
|
|
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
|
|
|
|
|
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
2025-07-31 20:12:01 +08:00
|
|
|
|
Content="{TemplateBinding SelectionBoxItem}"
|
|
|
|
|
|
ContentStringFormat="{TemplateBinding SelectionBoxItemStringFormat}"
|
|
|
|
|
|
ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}"
|
|
|
|
|
|
ContentTemplateSelector="{TemplateBinding ItemTemplateSelector}"
|
2025-12-23 21:35:54 +08:00
|
|
|
|
IsHitTestVisible="False"
|
2026-02-12 21:29:00 +08:00
|
|
|
|
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
|
2025-12-23 21:35:54 +08:00
|
|
|
|
</Grid>
|
|
|
|
|
|
<ControlTemplate.Triggers>
|
2026-02-12 21:29:00 +08:00
|
|
|
|
<Trigger SourceName="PART_Popup" Property="HasDropShadow" Value="True">
|
|
|
|
|
|
<Setter TargetName="dropDownBorder" Property="Effect" Value="{DynamicResource PopupShadow}" />
|
2025-12-23 21:35:54 +08:00
|
|
|
|
</Trigger>
|
|
|
|
|
|
<Trigger Property="HasItems" Value="False">
|
2026-02-12 21:29:00 +08:00
|
|
|
|
<Setter TargetName="dropDownBorder" Property="Height" Value="95" />
|
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>
|
2026-02-12 21:29:00 +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-12-23 21:35:54 +08:00
|
|
|
|
</Trigger>
|
|
|
|
|
|
<Trigger Property="IsEnabled" Value="False">
|
2026-02-12 21:29:00 +08:00
|
|
|
|
<Setter TargetName="contentPresenter" Property="TextElement.Foreground" Value="{DynamicResource TextDisabledBrush}" />
|
2025-12-23 21:35:54 +08:00
|
|
|
|
</Trigger>
|
|
|
|
|
|
</ControlTemplate.Triggers>
|
|
|
|
|
|
</ControlTemplate>
|
|
|
|
|
|
|
2026-02-12 21:29:00 +08:00
|
|
|
|
<Style x:Key="FloatComboBoxStyle" TargetType="{x:Type ComboBox}">
|
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="VerticalContentAlignment" Value="Center" />
|
|
|
|
|
|
<Setter Property="assists:InputAssist.PlaceholderText" Value="请选择..." />
|
|
|
|
|
|
<Setter Property="BorderThickness" Value="1" />
|
|
|
|
|
|
<Setter Property="FontSize" Value="14" />
|
2025-12-28 11:47:54 +08:00
|
|
|
|
<Setter Property="Padding" Value="8" />
|
2025-12-23 21:35:54 +08:00
|
|
|
|
<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="Template" Value="{StaticResource FloatComboBoxTemplate}" />
|
|
|
|
|
|
<Style.Triggers>
|
|
|
|
|
|
<Trigger Property="IsEditable" Value="True">
|
|
|
|
|
|
<Setter Property="IsTabStop" Value="False" />
|
|
|
|
|
|
<Setter Property="Padding" Value="3" />
|
|
|
|
|
|
<Setter Property="Template" Value="{StaticResource FloatComboBoxEditableTemplate}" />
|
|
|
|
|
|
</Trigger>
|
|
|
|
|
|
</Style.Triggers>
|
|
|
|
|
|
</Style>
|
|
|
|
|
|
<!--#endregion-->
|
|
|
|
|
|
|
2026-02-12 21:29:00 +08:00
|
|
|
|
<Style x:Key="ComboBoxToggleButton" TargetType="{x:Type ToggleButton}">
|
2025-12-23 21:35:54 +08:00
|
|
|
|
<Setter Property="OverridesDefaultStyle" Value="True" />
|
|
|
|
|
|
<Setter Property="IsTabStop" Value="False" />
|
|
|
|
|
|
<Setter Property="Focusable" Value="False" />
|
|
|
|
|
|
<Setter Property="ClickMode" Value="Press" />
|
|
|
|
|
|
<Setter Property="Template">
|
|
|
|
|
|
<Setter.Value>
|
|
|
|
|
|
<ControlTemplate TargetType="{x:Type ToggleButton}">
|
|
|
|
|
|
<Border
|
2026-02-12 21:29:00 +08:00
|
|
|
|
x:Name="border"
|
2025-12-23 21:35:54 +08:00
|
|
|
|
Background="{TemplateBinding Background}"
|
|
|
|
|
|
BorderBrush="{TemplateBinding BorderBrush}"
|
|
|
|
|
|
BorderThickness="{TemplateBinding BorderThickness}"
|
|
|
|
|
|
CornerRadius="{TemplateBinding assists:ControlAssist.CornerRadius}"
|
2026-02-12 21:29:00 +08:00
|
|
|
|
SnapsToDevicePixels="True">
|
2025-12-23 21:35:54 +08:00
|
|
|
|
<!-- 下拉箭头 -->
|
|
|
|
|
|
<Border
|
2026-02-12 21:29:00 +08:00
|
|
|
|
x:Name="splitBorder"
|
|
|
|
|
|
Width="{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}"
|
|
|
|
|
|
Margin="0,0,5,0"
|
|
|
|
|
|
HorizontalAlignment="Right"
|
2025-12-23 21:35:54 +08:00
|
|
|
|
BorderBrush="Transparent"
|
|
|
|
|
|
BorderThickness="1"
|
2026-02-12 21:29:00 +08:00
|
|
|
|
SnapsToDevicePixels="True">
|
2025-12-23 21:35:54 +08:00
|
|
|
|
<controls:IconElement
|
2026-02-12 21:29:00 +08:00
|
|
|
|
x:Name="arrow"
|
2025-12-23 21:35:54 +08:00
|
|
|
|
Foreground="{DynamicResource TextPrimaryBrush}"
|
|
|
|
|
|
RenderTransformOrigin="0.5,0.5"
|
|
|
|
|
|
SnapsToDevicePixels="false"
|
2026-02-12 21:29:00 +08:00
|
|
|
|
Symbol="KeyboardArrowDown">
|
2025-12-23 21:35:54 +08:00
|
|
|
|
<controls:IconElement.RenderTransform>
|
|
|
|
|
|
<RotateTransform Angle="0" />
|
|
|
|
|
|
</controls:IconElement.RenderTransform>
|
|
|
|
|
|
</controls:IconElement>
|
|
|
|
|
|
</Border>
|
|
|
|
|
|
</Border>
|
|
|
|
|
|
<ControlTemplate.Triggers>
|
|
|
|
|
|
<Trigger Property="IsMouseOver" Value="True">
|
2026-02-12 21:29:00 +08:00
|
|
|
|
<Setter TargetName="border" Property="Background" Value="{DynamicResource ControlBackgroundHoverBrush}" />
|
2025-12-23 21:35:54 +08:00
|
|
|
|
</Trigger>
|
|
|
|
|
|
<Trigger Property="IsChecked" Value="True">
|
2026-02-12 21:29:00 +08:00
|
|
|
|
<Setter TargetName="border" Property="BorderBrush" Value="{DynamicResource PrimaryFocusedBrush}" />
|
|
|
|
|
|
<Setter TargetName="border" Property="Background" Value="{DynamicResource ControlBackgroundNormalBrush}" />
|
2025-12-23 21:35:54 +08:00
|
|
|
|
<Trigger.EnterActions>
|
|
|
|
|
|
<BeginStoryboard Storyboard="{StaticResource ExpandRotateStoryboard}" />
|
|
|
|
|
|
</Trigger.EnterActions>
|
|
|
|
|
|
<Trigger.ExitActions>
|
|
|
|
|
|
<BeginStoryboard Storyboard="{StaticResource CollapseRotateStoryboard}" />
|
|
|
|
|
|
</Trigger.ExitActions>
|
|
|
|
|
|
</Trigger>
|
|
|
|
|
|
<!-- 按钮禁用效果 -->
|
|
|
|
|
|
<Trigger Property="IsEnabled" Value="False">
|
2026-02-12 21:29:00 +08:00
|
|
|
|
<Setter TargetName="arrow" Property="Foreground" Value="{DynamicResource TextDisabledBrush}" />
|
|
|
|
|
|
<Setter TargetName="border" Property="Background" Value="{DynamicResource ControlBackgroundDisabledBrush}" />
|
2025-12-23 21:35:54 +08:00
|
|
|
|
</Trigger>
|
|
|
|
|
|
</ControlTemplate.Triggers>
|
|
|
|
|
|
</ControlTemplate>
|
|
|
|
|
|
</Setter.Value>
|
|
|
|
|
|
</Setter>
|
|
|
|
|
|
</Style>
|
|
|
|
|
|
<!-- 可编辑模板 -->
|
2026-02-12 21:29:00 +08:00
|
|
|
|
<ControlTemplate x:Key="ComboBoxEditableTemplate" TargetType="{x:Type ComboBox}">
|
|
|
|
|
|
<Grid x:Name="templateRoot" SnapsToDevicePixels="True">
|
2025-12-23 21:35:54 +08:00
|
|
|
|
<Grid.ColumnDefinitions>
|
|
|
|
|
|
<ColumnDefinition Width="*" />
|
2026-02-12 21:29:00 +08:00
|
|
|
|
<ColumnDefinition Width="0" MinWidth="{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}" />
|
2025-12-23 21:35:54 +08:00
|
|
|
|
</Grid.ColumnDefinitions>
|
|
|
|
|
|
<Popup
|
2026-02-12 21:29:00 +08:00
|
|
|
|
x:Name="PART_Popup"
|
2026-01-02 17:30:30 +08:00
|
|
|
|
Grid.ColumnSpan="2"
|
|
|
|
|
|
Margin="-8"
|
2026-02-12 21:29:00 +08:00
|
|
|
|
AllowsTransparency="True"
|
|
|
|
|
|
IsOpen="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
|
2025-12-23 21:35:54 +08:00
|
|
|
|
Placement="Bottom"
|
|
|
|
|
|
PopupAnimation="Slide"
|
2026-02-12 21:29:00 +08:00
|
|
|
|
VerticalOffset="4">
|
2025-12-23 21:35:54 +08:00
|
|
|
|
<Border
|
2026-02-12 21:29:00 +08:00
|
|
|
|
x:Name="dropDownBorder"
|
|
|
|
|
|
MinWidth="{Binding ActualWidth, ElementName=templateRoot}"
|
|
|
|
|
|
MaxHeight="{TemplateBinding MaxDropDownHeight}"
|
|
|
|
|
|
Margin="8"
|
2025-12-23 21:35:54 +08:00
|
|
|
|
Background="{DynamicResource BackgroundFloatingBrush}"
|
|
|
|
|
|
BorderBrush="{DynamicResource BorderNormalBrush}"
|
|
|
|
|
|
BorderThickness="1"
|
2026-02-12 21:29:00 +08:00
|
|
|
|
CornerRadius="4">
|
|
|
|
|
|
<ScrollViewer x:Name="DropDownScrollViewer" Margin="4,3">
|
|
|
|
|
|
<Grid x:Name="grid" RenderOptions.ClearTypeHint="Enabled">
|
2025-12-23 21:35:54 +08:00
|
|
|
|
<Canvas
|
2026-02-12 21:29:00 +08:00
|
|
|
|
x:Name="canvas"
|
|
|
|
|
|
Width="0"
|
2025-12-23 21:35:54 +08:00
|
|
|
|
Height="0"
|
|
|
|
|
|
HorizontalAlignment="Left"
|
2026-02-12 21:29:00 +08:00
|
|
|
|
VerticalAlignment="Top">
|
2025-12-23 21:35:54 +08:00
|
|
|
|
<Rectangle
|
2026-02-12 21:29:00 +08:00
|
|
|
|
x:Name="opaqueRect"
|
2026-01-02 17:30:30 +08:00
|
|
|
|
Width="{Binding ActualWidth, ElementName=dropDownBorder}"
|
2026-02-12 21:29:00 +08:00
|
|
|
|
Height="{Binding ActualHeight, ElementName=dropDownBorder}"
|
|
|
|
|
|
Fill="{Binding Background, ElementName=dropDownBorder}" />
|
2025-12-23 21:35:54 +08:00
|
|
|
|
</Canvas>
|
|
|
|
|
|
<ItemsPresenter
|
2026-02-12 21:29:00 +08:00
|
|
|
|
x:Name="ItemsPresenter"
|
2025-12-23 21:35:54 +08:00
|
|
|
|
KeyboardNavigation.DirectionalNavigation="Contained"
|
2026-02-12 21:29:00 +08:00
|
|
|
|
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
|
2025-12-23 21:35:54 +08:00
|
|
|
|
</Grid>
|
|
|
|
|
|
</ScrollViewer>
|
|
|
|
|
|
</Border>
|
|
|
|
|
|
</Popup>
|
|
|
|
|
|
<ToggleButton
|
2026-02-12 21:29:00 +08:00
|
|
|
|
x:Name="toggleButton"
|
|
|
|
|
|
Grid.Column="0"
|
|
|
|
|
|
Grid.ColumnSpan="2"
|
2025-12-23 21:35:54 +08:00
|
|
|
|
Background="{TemplateBinding Background}"
|
|
|
|
|
|
BorderBrush="{TemplateBinding BorderBrush}"
|
|
|
|
|
|
BorderThickness="{TemplateBinding BorderThickness}"
|
|
|
|
|
|
IsChecked="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
|
2026-02-12 21:29:00 +08:00
|
|
|
|
Style="{StaticResource ComboBoxToggleButton}" />
|
2025-12-23 21:35:54 +08:00
|
|
|
|
<!-- 输入框 -->
|
|
|
|
|
|
<TextBox
|
2026-02-12 21:29:00 +08:00
|
|
|
|
x:Name="PART_EditableTextBox"
|
2025-12-23 21:35:54 +08:00
|
|
|
|
Grid.Column="0"
|
|
|
|
|
|
Margin="{TemplateBinding BorderThickness}"
|
|
|
|
|
|
Padding="{TemplateBinding Padding}"
|
2026-02-12 21:29:00 +08:00
|
|
|
|
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
|
2025-12-23 21:35:54 +08:00
|
|
|
|
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
|
2026-02-12 21:29:00 +08:00
|
|
|
|
Background="Transparent"
|
|
|
|
|
|
IsReadOnly="{Binding IsReadOnly, RelativeSource={RelativeSource TemplatedParent}}"
|
|
|
|
|
|
Style="{StaticResource FlattenTextBoxStyle}" />
|
2025-12-23 21:35:54 +08:00
|
|
|
|
<!-- 水印 -->
|
|
|
|
|
|
<Grid
|
|
|
|
|
|
Grid.Column="0"
|
2026-02-12 21:29:00 +08:00
|
|
|
|
Margin="{TemplateBinding BorderThickness}"
|
|
|
|
|
|
IsHitTestVisible="False">
|
2025-12-23 21:35:54 +08:00
|
|
|
|
<!-- 使用 Border 来模拟 Padding,这样可以更精确控制内部 TextBlock 的位置 -->
|
2026-02-12 21:29:00 +08:00
|
|
|
|
<Border Padding="{TemplateBinding Padding}" BorderThickness="0">
|
2025-12-23 21:35:54 +08:00
|
|
|
|
<TextBlock
|
2026-02-12 21:29:00 +08:00
|
|
|
|
x:Name="Placeholder"
|
2026-01-02 17:30:30 +08:00
|
|
|
|
Margin="2,0,0,0"
|
2026-02-12 21:29:00 +08:00
|
|
|
|
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
2025-12-23 21:35:54 +08:00
|
|
|
|
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
2026-02-12 21:29:00 +08:00
|
|
|
|
Foreground="{DynamicResource TextPlaceholderBrush}"
|
|
|
|
|
|
Text="{Binding Path=(assists:InputAssist.PlaceholderText), RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ComboBox}}">
|
2025-12-23 21:35:54 +08:00
|
|
|
|
<TextBlock.Style>
|
|
|
|
|
|
<Style TargetType="TextBlock">
|
|
|
|
|
|
<Setter Property="Visibility" Value="Collapsed" />
|
|
|
|
|
|
<Style.Triggers>
|
|
|
|
|
|
<DataTrigger Binding="{Binding SelectedItem, RelativeSource={RelativeSource AncestorType=ComboBox}}" Value="{x:Null}">
|
|
|
|
|
|
<Setter Property="Visibility" Value="Visible" />
|
|
|
|
|
|
</DataTrigger>
|
|
|
|
|
|
<!-- 后台给文本赋值时触发 -->
|
|
|
|
|
|
<DataTrigger Binding="{Binding Text, RelativeSource={RelativeSource AncestorType=ComboBox}, Converter={x:Static converters:NullOrEmptyConverter.Instance}}" Value="False">
|
|
|
|
|
|
<Setter Property="Visibility" Value="Collapsed" />
|
|
|
|
|
|
</DataTrigger>
|
|
|
|
|
|
</Style.Triggers>
|
|
|
|
|
|
</Style>
|
|
|
|
|
|
</TextBlock.Style>
|
|
|
|
|
|
</TextBlock>
|
|
|
|
|
|
</Border>
|
|
|
|
|
|
</Grid>
|
|
|
|
|
|
</Grid>
|
|
|
|
|
|
<ControlTemplate.Triggers>
|
|
|
|
|
|
<Trigger Property="IsEnabled" Value="False">
|
2026-02-12 21:29:00 +08:00
|
|
|
|
<Setter TargetName="PART_EditableTextBox" Property="Foreground" Value="{DynamicResource TextDisabledBrush}" />
|
2025-12-23 21:35:54 +08:00
|
|
|
|
</Trigger>
|
|
|
|
|
|
<Trigger Property="IsKeyboardFocusWithin" Value="True" />
|
2026-02-12 21:29:00 +08:00
|
|
|
|
<Trigger SourceName="PART_Popup" Property="HasDropShadow" Value="True">
|
|
|
|
|
|
<Setter TargetName="dropDownBorder" Property="Effect" Value="{DynamicResource PopupShadow}" />
|
2025-12-23 21:35:54 +08:00
|
|
|
|
</Trigger>
|
|
|
|
|
|
<Trigger Property="HasItems" Value="False">
|
2026-02-12 21:29:00 +08:00
|
|
|
|
<Setter TargetName="dropDownBorder" Property="Height" Value="95" />
|
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>
|
2026-02-12 21:29:00 +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-12-23 21:35:54 +08:00
|
|
|
|
</Trigger>
|
|
|
|
|
|
</ControlTemplate.Triggers>
|
|
|
|
|
|
</ControlTemplate>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 默认控件模板 -->
|
2026-02-12 21:29:00 +08:00
|
|
|
|
<ControlTemplate x:Key="ComboBoxTemplate" TargetType="{x:Type ComboBox}">
|
|
|
|
|
|
<Grid x:Name="templateRoot" SnapsToDevicePixels="True">
|
2025-12-23 21:35:54 +08:00
|
|
|
|
<Grid.ColumnDefinitions>
|
|
|
|
|
|
<ColumnDefinition Width="*" />
|
2026-02-12 21:29:00 +08:00
|
|
|
|
<ColumnDefinition Width="0" MinWidth="{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}" />
|
2025-12-23 21:35:54 +08:00
|
|
|
|
</Grid.ColumnDefinitions>
|
|
|
|
|
|
<Popup
|
2026-02-12 21:29:00 +08:00
|
|
|
|
x:Name="PART_Popup"
|
2026-01-02 17:30:30 +08:00
|
|
|
|
Grid.ColumnSpan="2"
|
2026-02-12 21:29:00 +08:00
|
|
|
|
AllowsTransparency="True"
|
2025-12-23 21:35:54 +08:00
|
|
|
|
IsOpen="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
|
|
|
|
|
|
Placement="Bottom"
|
|
|
|
|
|
PopupAnimation="Slide"
|
2026-02-12 21:29:00 +08:00
|
|
|
|
VerticalOffset="4">
|
2025-12-23 21:35:54 +08:00
|
|
|
|
<Border
|
2026-02-12 21:29:00 +08:00
|
|
|
|
x:Name="dropDownBorder"
|
|
|
|
|
|
MinWidth="{Binding ActualWidth, ElementName=templateRoot}"
|
|
|
|
|
|
MaxHeight="{TemplateBinding MaxDropDownHeight}"
|
|
|
|
|
|
Margin="8"
|
2025-12-23 21:35:54 +08:00
|
|
|
|
Background="{DynamicResource BackgroundFloatingBrush}"
|
|
|
|
|
|
BorderBrush="{DynamicResource BorderNormalBrush}"
|
|
|
|
|
|
BorderThickness="1"
|
2026-02-12 21:29:00 +08:00
|
|
|
|
CornerRadius="4">
|
|
|
|
|
|
<Border.Effect>
|
|
|
|
|
|
<DropShadowEffect
|
|
|
|
|
|
BlurRadius="10"
|
|
|
|
|
|
Direction="270"
|
|
|
|
|
|
Opacity="0.1"
|
|
|
|
|
|
ShadowDepth="2"
|
|
|
|
|
|
Color="#000" />
|
|
|
|
|
|
</Border.Effect>
|
|
|
|
|
|
<ScrollViewer x:Name="DropDownScrollViewer" Margin="4,3">
|
|
|
|
|
|
<Grid x:Name="grid" RenderOptions.ClearTypeHint="Enabled">
|
2025-12-23 21:35:54 +08:00
|
|
|
|
<Canvas
|
2026-02-12 21:29:00 +08:00
|
|
|
|
x:Name="canvas"
|
|
|
|
|
|
Width="0"
|
2025-12-23 21:35:54 +08:00
|
|
|
|
Height="0"
|
|
|
|
|
|
HorizontalAlignment="Left"
|
2026-02-12 21:29:00 +08:00
|
|
|
|
VerticalAlignment="Top">
|
2025-12-23 21:35:54 +08:00
|
|
|
|
<Rectangle
|
2026-02-12 21:29:00 +08:00
|
|
|
|
x:Name="opaqueRect"
|
2026-01-02 17:30:30 +08:00
|
|
|
|
Width="{Binding ActualWidth, ElementName=dropDownBorder}"
|
2026-02-12 21:29:00 +08:00
|
|
|
|
Height="{Binding ActualHeight, ElementName=dropDownBorder}"
|
|
|
|
|
|
Fill="{Binding Background, ElementName=dropDownBorder}" />
|
2025-12-23 21:35:54 +08:00
|
|
|
|
</Canvas>
|
|
|
|
|
|
<ItemsPresenter
|
2026-02-12 21:29:00 +08:00
|
|
|
|
x:Name="ItemsPresenter"
|
2025-12-23 21:35:54 +08:00
|
|
|
|
KeyboardNavigation.DirectionalNavigation="Contained"
|
2026-02-12 21:29:00 +08:00
|
|
|
|
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
|
2025-12-23 21:35:54 +08:00
|
|
|
|
</Grid>
|
|
|
|
|
|
</ScrollViewer>
|
|
|
|
|
|
</Border>
|
|
|
|
|
|
</Popup>
|
|
|
|
|
|
<ToggleButton
|
2026-02-12 21:29:00 +08:00
|
|
|
|
x:Name="toggleButton"
|
|
|
|
|
|
Grid.Column="0"
|
|
|
|
|
|
Grid.ColumnSpan="2"
|
2025-12-23 21:35:54 +08:00
|
|
|
|
Background="{TemplateBinding Background}"
|
|
|
|
|
|
BorderBrush="{TemplateBinding BorderBrush}"
|
|
|
|
|
|
BorderThickness="{TemplateBinding BorderThickness}"
|
|
|
|
|
|
IsChecked="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
|
2026-02-12 21:29:00 +08:00
|
|
|
|
Style="{StaticResource ComboBoxToggleButton}" />
|
2025-12-23 21:35:54 +08:00
|
|
|
|
|
|
|
|
|
|
<!-- 占位符 TextBlock (保持原样,它已经有了 Margin) -->
|
|
|
|
|
|
<TextBlock
|
2026-02-12 21:29:00 +08:00
|
|
|
|
x:Name="Placeholder"
|
2025-12-23 21:35:54 +08:00
|
|
|
|
Grid.Column="0"
|
|
|
|
|
|
Margin="{TemplateBinding BorderThickness}"
|
|
|
|
|
|
Padding="{TemplateBinding Padding}"
|
|
|
|
|
|
VerticalAlignment="Center"
|
2026-02-12 21:29:00 +08:00
|
|
|
|
Foreground="{DynamicResource TextPlaceholderBrush}"
|
|
|
|
|
|
IsHitTestVisible="False"
|
|
|
|
|
|
Text="{Binding Path=(assists:InputAssist.PlaceholderText), RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ComboBox}}">
|
2025-12-23 21:35:54 +08:00
|
|
|
|
<TextBlock.Style>
|
|
|
|
|
|
<Style TargetType="TextBlock">
|
|
|
|
|
|
<Setter Property="Visibility" Value="Collapsed" />
|
|
|
|
|
|
<Style.Triggers>
|
|
|
|
|
|
<DataTrigger Binding="{Binding SelectedItem, RelativeSource={RelativeSource AncestorType=ComboBox}}" Value="{x:Null}">
|
|
|
|
|
|
<Setter Property="Visibility" Value="Visible" />
|
|
|
|
|
|
</DataTrigger>
|
|
|
|
|
|
</Style.Triggers>
|
|
|
|
|
|
</Style>
|
|
|
|
|
|
</TextBlock.Style>
|
|
|
|
|
|
</TextBlock>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 核心修改:在 ContentPresenter 外层增加一个 Border 来模拟 BorderThickness -->
|
|
|
|
|
|
<Border
|
2026-02-12 21:29:00 +08:00
|
|
|
|
Grid.Column="0"
|
2025-12-23 21:35:54 +08:00
|
|
|
|
BorderBrush="Transparent"
|
2026-02-12 21:29:00 +08:00
|
|
|
|
BorderThickness="{TemplateBinding BorderThickness}">
|
2025-12-23 21:35:54 +08:00
|
|
|
|
<ContentPresenter
|
2026-02-12 21:29:00 +08:00
|
|
|
|
x:Name="contentPresenter"
|
|
|
|
|
|
Margin="{TemplateBinding Padding}"
|
|
|
|
|
|
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
|
|
|
|
|
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
2025-12-23 21:35:54 +08:00
|
|
|
|
Content="{TemplateBinding SelectionBoxItem}"
|
|
|
|
|
|
ContentStringFormat="{TemplateBinding SelectionBoxItemStringFormat}"
|
|
|
|
|
|
ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}"
|
|
|
|
|
|
ContentTemplateSelector="{TemplateBinding ItemTemplateSelector}"
|
|
|
|
|
|
IsHitTestVisible="False"
|
2026-02-12 21:29:00 +08:00
|
|
|
|
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
|
2025-12-23 21:35:54 +08:00
|
|
|
|
</Border>
|
|
|
|
|
|
|
2025-07-11 09:20:23 +08:00
|
|
|
|
</Grid>
|
|
|
|
|
|
<ControlTemplate.Triggers>
|
2026-02-12 21:29:00 +08:00
|
|
|
|
<Trigger SourceName="PART_Popup" Property="HasDropShadow" Value="True">
|
|
|
|
|
|
<Setter TargetName="dropDownBorder" Property="Effect" Value="{DynamicResource PopupShadow}" />
|
2025-07-11 09:20:23 +08:00
|
|
|
|
</Trigger>
|
2025-08-20 12:10:13 +08:00
|
|
|
|
<Trigger Property="HasItems" Value="False">
|
2026-02-12 21:29:00 +08:00
|
|
|
|
<Setter TargetName="dropDownBorder" Property="Height" Value="95" />
|
2025-07-11 09:20:23 +08:00
|
|
|
|
</Trigger>
|
|
|
|
|
|
<MultiTrigger>
|
|
|
|
|
|
<MultiTrigger.Conditions>
|
2025-08-20 12:10:13 +08:00
|
|
|
|
<Condition Property="IsGrouping" Value="True" />
|
|
|
|
|
|
<Condition Property="VirtualizingPanel.IsVirtualizingWhenGrouping" Value="False" />
|
2025-07-11 09:20:23 +08:00
|
|
|
|
</MultiTrigger.Conditions>
|
2025-08-20 12:10:13 +08:00
|
|
|
|
<Setter Property="ScrollViewer.CanContentScroll" Value="False" />
|
2025-07-11 09:20:23 +08:00
|
|
|
|
</MultiTrigger>
|
2026-02-12 21:29:00 +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-11 09:20:23 +08:00
|
|
|
|
</Trigger>
|
2025-09-12 09:55:36 +08:00
|
|
|
|
<Trigger Property="IsEnabled" Value="False">
|
2026-02-12 21:29:00 +08:00
|
|
|
|
<Setter TargetName="contentPresenter" Property="TextElement.Foreground" Value="{DynamicResource TextDisabledBrush}" />
|
2025-09-12 09:55:36 +08:00
|
|
|
|
</Trigger>
|
2025-07-11 09:20:23 +08:00
|
|
|
|
</ControlTemplate.Triggers>
|
|
|
|
|
|
</ControlTemplate>
|
2025-12-23 21:35:54 +08:00
|
|
|
|
|
2025-08-20 12:10:35 +08:00
|
|
|
|
<!-- 默认ComboBox样式 -->
|
2026-02-12 21:29:00 +08:00
|
|
|
|
<Style x:Key="DefaultComboBoxStyle" TargetType="{x:Type ComboBox}">
|
2025-08-26 21:33:20 +08:00
|
|
|
|
<Setter Property="FocusVisualStyle" Value="{DynamicResource FocusVisual}" />
|
2025-08-12 23:08:54 +08:00
|
|
|
|
<Setter Property="Background" Value="{DynamicResource ControlBackgroundNormalBrush}" />
|
2025-12-23 21:35:54 +08:00
|
|
|
|
<Setter Property="BorderBrush" Value="Transparent" />
|
2025-08-12 23:08:54 +08:00
|
|
|
|
<Setter Property="Foreground" Value="{DynamicResource TextPrimaryBrush}" />
|
2025-09-04 22:39:00 +08:00
|
|
|
|
<Setter Property="VerticalContentAlignment" Value="Center" />
|
2025-12-23 21:35:54 +08:00
|
|
|
|
<Setter Property="VerticalAlignment" Value="Center" />
|
|
|
|
|
|
<Setter Property="assists:InputAssist.PlaceholderText" Value="请选择..." />
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<Setter Property="BorderThickness" Value="1" />
|
|
|
|
|
|
<Setter Property="Padding" Value="10,8" />
|
2025-12-23 21:35:54 +08:00
|
|
|
|
<Setter Property="FontSize" Value="14" />
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto" />
|
|
|
|
|
|
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto" />
|
2025-08-20 12:10:13 +08:00
|
|
|
|
<Setter Property="ScrollViewer.CanContentScroll" Value="True" />
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<Setter Property="ScrollViewer.PanningMode" Value="Both" />
|
|
|
|
|
|
<Setter Property="Stylus.IsFlicksEnabled" Value="False" />
|
|
|
|
|
|
<Setter Property="Template" Value="{StaticResource ComboBoxTemplate}" />
|
2025-07-11 09:20:23 +08:00
|
|
|
|
<Style.Triggers>
|
2025-08-20 12:10:13 +08:00
|
|
|
|
<Trigger Property="IsEditable" Value="True">
|
|
|
|
|
|
<Setter Property="IsTabStop" Value="False" />
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<Setter Property="Template" Value="{StaticResource ComboBoxEditableTemplate}" />
|
2025-07-11 09:20:23 +08:00
|
|
|
|
</Trigger>
|
|
|
|
|
|
</Style.Triggers>
|
|
|
|
|
|
</Style>
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<!-- 默认下拉样式 -->
|
2025-10-10 11:19:58 +08:00
|
|
|
|
<Style BasedOn="{StaticResource DefaultComboBoxStyle}" TargetType="{x:Type ComboBox}" />
|
2026-02-12 21:29:00 +08:00
|
|
|
|
<Style BasedOn="{StaticResource DefaultComboBoxStyle}" TargetType="{x:Type controls:SearchableComboBox}" />
|
2025-07-11 09:20:23 +08:00
|
|
|
|
|
2025-12-23 21:35:54 +08:00
|
|
|
|
<!--#region 工具栏样式-->
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<!-- 工具栏下拉Toggle -->
|
2026-02-12 21:29:00 +08:00
|
|
|
|
<Style x:Key="ToolbarComboBoxToggleButtonStyle" TargetType="{x:Type ToggleButton}">
|
2025-08-20 12:10:13 +08:00
|
|
|
|
<Setter Property="OverridesDefaultStyle" Value="True" />
|
|
|
|
|
|
<Setter Property="IsTabStop" Value="False" />
|
|
|
|
|
|
<Setter Property="Focusable" Value="False" />
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<Setter Property="ClickMode" Value="Press" />
|
2025-07-11 09:20:23 +08:00
|
|
|
|
<Setter Property="Template">
|
|
|
|
|
|
<Setter.Value>
|
|
|
|
|
|
<ControlTemplate TargetType="{x:Type ToggleButton}">
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<Border
|
2026-02-12 21:29:00 +08:00
|
|
|
|
x:Name="border"
|
|
|
|
|
|
Margin="4"
|
2025-07-31 20:12:01 +08:00
|
|
|
|
Background="{TemplateBinding Background}"
|
|
|
|
|
|
BorderBrush="{TemplateBinding BorderBrush}"
|
|
|
|
|
|
BorderThickness="{TemplateBinding BorderThickness}"
|
|
|
|
|
|
CornerRadius="4"
|
2026-02-12 21:29:00 +08:00
|
|
|
|
SnapsToDevicePixels="True">
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<!-- 下拉箭头 -->
|
|
|
|
|
|
<Border
|
2026-02-12 21:29:00 +08:00
|
|
|
|
x:Name="splitBorder"
|
|
|
|
|
|
Width="{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}"
|
2026-01-02 17:30:30 +08:00
|
|
|
|
Margin="0"
|
|
|
|
|
|
Padding="0,0,2,0"
|
2026-02-12 21:29:00 +08:00
|
|
|
|
HorizontalAlignment="Right"
|
|
|
|
|
|
BorderBrush="Transparent"
|
|
|
|
|
|
BorderThickness="1"
|
|
|
|
|
|
SnapsToDevicePixels="True">
|
2025-09-08 19:49:09 +08:00
|
|
|
|
<controls:IconElement
|
2026-02-12 21:29:00 +08:00
|
|
|
|
x:Name="arrow"
|
2025-09-08 19:49:09 +08:00
|
|
|
|
Foreground="{DynamicResource TextPrimaryBrush}"
|
2025-09-06 00:36:23 +08:00
|
|
|
|
RenderTransformOrigin="0.5,0.5"
|
2025-09-08 19:49:09 +08:00
|
|
|
|
SnapsToDevicePixels="false"
|
2026-02-12 21:29:00 +08:00
|
|
|
|
Symbol="KeyboardArrowDown">
|
2025-09-08 19:49:09 +08:00
|
|
|
|
<controls:IconElement.RenderTransform>
|
2025-09-04 22:39:00 +08:00
|
|
|
|
<RotateTransform Angle="0" />
|
2025-09-08 19:49:09 +08:00
|
|
|
|
</controls:IconElement.RenderTransform>
|
|
|
|
|
|
</controls:IconElement>
|
2025-07-11 09:20:23 +08:00
|
|
|
|
</Border>
|
|
|
|
|
|
</Border>
|
|
|
|
|
|
<ControlTemplate.Triggers>
|
2025-08-20 12:10:13 +08:00
|
|
|
|
<Trigger Property="IsMouseOver" Value="True">
|
2026-02-12 21:29:00 +08:00
|
|
|
|
<Setter TargetName="border" Property="BorderBrush" Value="{DynamicResource PrimaryNormalBrush}" />
|
2025-07-11 09:20:23 +08:00
|
|
|
|
</Trigger>
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<!-- 下压效果 -->
|
2025-08-20 12:10:13 +08:00
|
|
|
|
<Trigger Property="IsPressed" Value="True">
|
2026-02-12 21:29:00 +08:00
|
|
|
|
<Setter TargetName="border" Property="BorderBrush" Value="{DynamicResource PrimaryPressedBrush}" />
|
2025-07-11 09:20:23 +08:00
|
|
|
|
</Trigger>
|
|
|
|
|
|
<Trigger Property="IsChecked" Value="True">
|
2026-02-12 21:29:00 +08:00
|
|
|
|
<Setter TargetName="border" Property="BorderBrush" Value="{DynamicResource PrimaryFocusedBrush}" />
|
|
|
|
|
|
<Setter TargetName="arrow" Property="RenderTransform">
|
2025-09-04 22:39:00 +08:00
|
|
|
|
<Setter.Value>
|
|
|
|
|
|
<RotateTransform Angle="180" />
|
|
|
|
|
|
</Setter.Value>
|
|
|
|
|
|
</Setter>
|
2025-07-11 09:20:23 +08:00
|
|
|
|
</Trigger>
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<!-- 按钮禁用效果 -->
|
2025-08-20 12:10:13 +08:00
|
|
|
|
<Trigger Property="IsEnabled" Value="False">
|
2026-02-12 21:29:00 +08:00
|
|
|
|
<Setter TargetName="arrow" Property="Foreground" Value="{DynamicResource TextDisabledBrush}" />
|
|
|
|
|
|
<Setter TargetName="border" Property="Background" Value="{DynamicResource ControlBackgroundDisabledBrush}" />
|
2025-07-11 09:20:23 +08:00
|
|
|
|
</Trigger>
|
|
|
|
|
|
</ControlTemplate.Triggers>
|
|
|
|
|
|
</ControlTemplate>
|
|
|
|
|
|
</Setter.Value>
|
|
|
|
|
|
</Setter>
|
|
|
|
|
|
</Style>
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<!-- 工具栏默认样式 -->
|
2026-02-12 21:29:00 +08:00
|
|
|
|
<ControlTemplate x:Key="ToolBarComboBoxTemplate" TargetType="{x:Type ComboBox}">
|
|
|
|
|
|
<Grid x:Name="templateRoot" SnapsToDevicePixels="True">
|
2025-07-11 09:20:23 +08:00
|
|
|
|
<Grid.ColumnDefinitions>
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<ColumnDefinition Width="*" />
|
2026-02-12 21:29:00 +08:00
|
|
|
|
<ColumnDefinition Width="0" MinWidth="{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}" />
|
2025-07-11 09:20:23 +08:00
|
|
|
|
</Grid.ColumnDefinitions>
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<Popup
|
2026-02-12 21:29:00 +08:00
|
|
|
|
x:Name="PART_Popup"
|
2026-01-02 17:30:30 +08:00
|
|
|
|
Grid.ColumnSpan="2"
|
|
|
|
|
|
Margin="-8"
|
2026-02-12 21:29:00 +08:00
|
|
|
|
AllowsTransparency="True"
|
|
|
|
|
|
IsOpen="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
|
2025-07-31 20:12:01 +08:00
|
|
|
|
Placement="Bottom"
|
|
|
|
|
|
PopupAnimation="Slide"
|
2026-02-12 21:29:00 +08:00
|
|
|
|
VerticalOffset="4">
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<Border
|
2026-02-12 21:29:00 +08:00
|
|
|
|
x:Name="dropDownBorder"
|
|
|
|
|
|
MinWidth="{Binding ActualWidth, ElementName=templateRoot}"
|
|
|
|
|
|
MaxHeight="{TemplateBinding MaxDropDownHeight}"
|
|
|
|
|
|
Margin="8"
|
2025-09-06 00:36:23 +08:00
|
|
|
|
Background="{DynamicResource BackgroundFloatingBrush}"
|
2025-08-12 23:08:54 +08:00
|
|
|
|
BorderBrush="{DynamicResource BorderNormalBrush}"
|
2025-07-31 20:12:01 +08:00
|
|
|
|
BorderThickness="1"
|
2026-02-12 21:29:00 +08:00
|
|
|
|
CornerRadius="4">
|
|
|
|
|
|
<ScrollViewer x:Name="DropDownScrollViewer" Margin="4,3">
|
|
|
|
|
|
<Grid x:Name="grid" RenderOptions.ClearTypeHint="Enabled">
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<Canvas
|
2026-02-12 21:29:00 +08:00
|
|
|
|
x:Name="canvas"
|
|
|
|
|
|
Width="0"
|
2025-07-31 20:12:01 +08:00
|
|
|
|
Height="0"
|
|
|
|
|
|
HorizontalAlignment="Left"
|
2026-02-12 21:29:00 +08:00
|
|
|
|
VerticalAlignment="Top">
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<Rectangle
|
2026-02-12 21:29:00 +08:00
|
|
|
|
x:Name="opaqueRect"
|
2026-01-02 17:30:30 +08:00
|
|
|
|
Width="{Binding ActualWidth, ElementName=dropDownBorder}"
|
2026-02-12 21:29:00 +08:00
|
|
|
|
Height="{Binding ActualHeight, ElementName=dropDownBorder}"
|
|
|
|
|
|
Fill="{Binding Background, ElementName=dropDownBorder}" />
|
2025-07-11 09:20:23 +08:00
|
|
|
|
</Canvas>
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<ItemsPresenter
|
2026-02-12 21:29:00 +08:00
|
|
|
|
x:Name="ItemsPresenter"
|
2025-07-31 20:12:01 +08:00
|
|
|
|
KeyboardNavigation.DirectionalNavigation="Contained"
|
2026-02-12 21:29:00 +08:00
|
|
|
|
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
|
2025-07-11 09:20:23 +08:00
|
|
|
|
</Grid>
|
|
|
|
|
|
</ScrollViewer>
|
|
|
|
|
|
</Border>
|
|
|
|
|
|
|
|
|
|
|
|
</Popup>
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<ToggleButton
|
2026-02-12 21:29:00 +08:00
|
|
|
|
x:Name="toggleButton"
|
|
|
|
|
|
Grid.Column="0"
|
|
|
|
|
|
Grid.ColumnSpan="2"
|
|
|
|
|
|
Margin="-4"
|
2025-07-31 20:12:01 +08:00
|
|
|
|
Background="{TemplateBinding Background}"
|
|
|
|
|
|
BorderBrush="{TemplateBinding BorderBrush}"
|
|
|
|
|
|
BorderThickness="{TemplateBinding BorderThickness}"
|
|
|
|
|
|
IsChecked="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
|
2026-02-12 21:29:00 +08:00
|
|
|
|
Style="{StaticResource ToolbarComboBoxToggleButtonStyle}" />
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<ContentPresenter
|
2026-02-12 21:29:00 +08:00
|
|
|
|
x:Name="contentPresenter"
|
|
|
|
|
|
Grid.Column="0"
|
|
|
|
|
|
Margin="{TemplateBinding Padding}"
|
|
|
|
|
|
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
|
|
|
|
|
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
2025-07-31 20:12:01 +08:00
|
|
|
|
Content="{TemplateBinding SelectionBoxItem}"
|
|
|
|
|
|
ContentStringFormat="{TemplateBinding SelectionBoxItemStringFormat}"
|
|
|
|
|
|
ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}"
|
|
|
|
|
|
ContentTemplateSelector="{TemplateBinding ItemTemplateSelector}"
|
2025-08-20 12:10:13 +08:00
|
|
|
|
IsHitTestVisible="False"
|
2026-02-12 21:29:00 +08:00
|
|
|
|
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
|
2025-07-11 09:20:23 +08:00
|
|
|
|
</Grid>
|
|
|
|
|
|
<ControlTemplate.Triggers>
|
2026-02-12 21:29:00 +08:00
|
|
|
|
<Trigger SourceName="PART_Popup" Property="HasDropShadow" Value="True">
|
|
|
|
|
|
<Setter TargetName="dropDownBorder" Property="Effect" Value="{DynamicResource PopupShadow}" />
|
2025-07-11 09:20:23 +08:00
|
|
|
|
</Trigger>
|
2025-08-20 12:10:13 +08:00
|
|
|
|
<Trigger Property="HasItems" Value="False">
|
2026-02-12 21:29:00 +08:00
|
|
|
|
<Setter TargetName="dropDownBorder" Property="Height" Value="95" />
|
2025-07-11 09:20:23 +08:00
|
|
|
|
</Trigger>
|
|
|
|
|
|
<MultiTrigger>
|
|
|
|
|
|
<MultiTrigger.Conditions>
|
2025-08-20 12:10:13 +08:00
|
|
|
|
<Condition Property="IsGrouping" Value="True" />
|
|
|
|
|
|
<Condition Property="VirtualizingPanel.IsVirtualizingWhenGrouping" Value="False" />
|
2025-07-11 09:20:23 +08:00
|
|
|
|
</MultiTrigger.Conditions>
|
2025-08-20 12:10:13 +08:00
|
|
|
|
<Setter Property="ScrollViewer.CanContentScroll" Value="False" />
|
2025-07-11 09:20:23 +08:00
|
|
|
|
</MultiTrigger>
|
2026-02-12 21:29:00 +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-11 09:20:23 +08:00
|
|
|
|
</Trigger>
|
|
|
|
|
|
</ControlTemplate.Triggers>
|
|
|
|
|
|
</ControlTemplate>
|
|
|
|
|
|
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<!-- 工具栏下拉样式 -->
|
|
|
|
|
|
<Style
|
2026-02-12 21:29:00 +08:00
|
|
|
|
x:Key="{x:Static ToolBar.ComboBoxStyleKey}"
|
2025-10-10 11:19:58 +08:00
|
|
|
|
BasedOn="{StaticResource DefaultComboBoxStyle}"
|
2026-02-12 21:29:00 +08:00
|
|
|
|
TargetType="{x:Type ComboBox}">
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<Setter Property="Margin" Value="2" />
|
|
|
|
|
|
<Setter Property="Padding" Value="4,2" />
|
|
|
|
|
|
<Setter Property="Template" Value="{StaticResource ToolBarComboBoxTemplate}" />
|
2025-07-11 09:20:23 +08:00
|
|
|
|
</Style>
|
2025-12-23 21:35:54 +08:00
|
|
|
|
<!--#endregion-->
|
2025-07-11 09:20:23 +08:00
|
|
|
|
|
|
|
|
|
|
</ResourceDictionary>
|