更新
This commit is contained in:
@@ -1,15 +1,14 @@
|
||||
<ResourceDictionary
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:controls="clr-namespace:WPFluent.Controls"
|
||||
xmlns:converters="clr-namespace:WPFluent.Converters"
|
||||
xmlns:system="clr-namespace:System;assembly=mscorlib">
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<!--<ResourceDictionary Source="pack://application:,,,/WPFluent;component/Resources/Variables.xaml" />-->
|
||||
<ResourceDictionary Source="pack://application:,,,/WPFluent;component/Controls/ComboBox/ComboBox.xaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
<converters:BooleanToVisConverter x:Key="BooleanToVisConverter" />
|
||||
<Style x:Key="DefaultComboBoxExStyle" TargetType="{x:Type controls:ComboBoxEx}">
|
||||
<Style TargetType="{x:Type controls:ComboBoxEx}" x:Key="DefaultComboBoxExStyle">
|
||||
<Style.Triggers>
|
||||
<Trigger Property="HeaderPlacement" Value="Left">
|
||||
<Setter Property="HorizontalAlignment" Value="Right" />
|
||||
@@ -17,10 +16,6 @@
|
||||
<Trigger Property="HeaderPlacement" Value="Right">
|
||||
<Setter Property="HorizontalAlignment" Value="Left" />
|
||||
</Trigger>
|
||||
<!--<Trigger Property="MultiSelect" Value="True">
|
||||
<Setter Property="ItemContainerStyle" Value="{StaticResource DefaultMultiComboxBoxItemStyle}" />
|
||||
<Setter Property="Template" Value="{StaticResource DefaultMultiComboBoxExControlTemplate}" />
|
||||
</Trigger>-->
|
||||
</Style.Triggers>
|
||||
<!-- Universal WPF UI focus -->
|
||||
<Setter Property="FocusVisualStyle" Value="{DynamicResource DefaultControlFocusVisualStyle}" />
|
||||
@@ -28,12 +23,12 @@
|
||||
<!-- Universal WPF UI ContextMenu -->
|
||||
<Setter Property="ContextMenu" Value="{DynamicResource DefaultControlContextMenu}" />
|
||||
<!-- Universal WPF UI ContextMenu -->
|
||||
<Setter Property="Background" Value="{DynamicResource ComboBoxBackground}" />
|
||||
<Setter Property="Background" Value="{DynamicResource ControlFillColorDefaultBrush}" />
|
||||
<Setter Property="Border.CornerRadius" Value="{StaticResource ControlCornerRadius}" />
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource ControlElevationBorderBrush}" />
|
||||
<Setter Property="BorderThickness" Value="{StaticResource ComboBoxBorderThemeThickness}" />
|
||||
<Setter Property="FontSize" Value="{StaticResource ControlContentThemeFontSize}" />
|
||||
<Setter Property="Foreground" Value="{DynamicResource ComboBoxForeground}" />
|
||||
<Setter Property="Foreground" Value="{DynamicResource TextFillColorPrimaryBrush}" />
|
||||
<Setter Property="HorizontalAlignment" Value="Stretch" />
|
||||
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
|
||||
<Setter Property="MinHeight" Value="{StaticResource TextControlThemeMinHeight}" />
|
||||
@@ -55,33 +50,33 @@
|
||||
<DockPanel>
|
||||
<!-- 标题 -->
|
||||
<TextBlock
|
||||
x:Name="Header_TextBlock"
|
||||
Margin="5"
|
||||
VerticalAlignment="Center"
|
||||
DockPanel.Dock="{TemplateBinding HeaderPlacement}"
|
||||
FontSize="{TemplateBinding FontSize}"
|
||||
Text="{TemplateBinding Header}" />
|
||||
Margin="5"
|
||||
Text="{TemplateBinding Header}"
|
||||
VerticalAlignment="Center"
|
||||
x:Name="Header_TextBlock" />
|
||||
<Grid
|
||||
x:Name="Grid"
|
||||
HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
|
||||
VerticalAlignment="{TemplateBinding VerticalAlignment}">
|
||||
VerticalAlignment="{TemplateBinding VerticalAlignment}"
|
||||
x:Name="Grid">
|
||||
<!-- 强调边缘 只有IsEditable时出现 -->
|
||||
<Border
|
||||
x:Name="AccentBorder"
|
||||
BorderBrush="{DynamicResource ComboBoxBorderBrushFocused}"
|
||||
BorderBrush="{DynamicResource SystemFillColorAttentionBrush}"
|
||||
BorderThickness="{StaticResource ComboBoxAccentBorderThemeThickness}"
|
||||
CornerRadius="{TemplateBinding Border.CornerRadius}"
|
||||
Visibility="Collapsed" />
|
||||
Visibility="Collapsed"
|
||||
x:Name="AccentBorder" />
|
||||
<Border
|
||||
x:Name="ContentBorder"
|
||||
Grid.Row="0"
|
||||
MinWidth="{TemplateBinding MinWidth}"
|
||||
MinHeight="{TemplateBinding MinHeight}"
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
CornerRadius="{TemplateBinding Border.CornerRadius}"
|
||||
Padding="0">
|
||||
Grid.Row="0"
|
||||
MinHeight="{TemplateBinding MinHeight}"
|
||||
MinWidth="{TemplateBinding MinWidth}"
|
||||
Padding="0"
|
||||
x:Name="ContentBorder">
|
||||
<Grid>
|
||||
<!--
|
||||
Chevron 位于 Presenter 上,ToggleButton 位于 Chevron 上,TextBox 位于 ToggleButton 上。
|
||||
@@ -96,15 +91,15 @@
|
||||
<Grid Grid.Column="0" Margin="{TemplateBinding Padding}">
|
||||
<!--#region 扩展水印-->
|
||||
<TextBlock
|
||||
x:Name="PlaceholderTextBlock"
|
||||
VerticalAlignment="Center"
|
||||
Focusable="False"
|
||||
FontSize="{TemplateBinding FontSize}"
|
||||
Foreground="{DynamicResource TextControlPlaceholderForeground}"
|
||||
Foreground="{DynamicResource TextFillColorSecondaryBrush}"
|
||||
IsHitTestVisible="False"
|
||||
Padding="1,0"
|
||||
Text="{TemplateBinding PlaceholderText}"
|
||||
Visibility="Collapsed" />
|
||||
VerticalAlignment="Center"
|
||||
Visibility="Collapsed"
|
||||
x:Name="PlaceholderTextBlock" />
|
||||
<!--#endregion-->
|
||||
<ContentPresenter
|
||||
Content="{TemplateBinding SelectionBoxItem}"
|
||||
@@ -116,33 +111,33 @@
|
||||
</Grid>
|
||||
<!-- 可编辑时 -->
|
||||
<ToggleButton
|
||||
Grid.Column="0"
|
||||
Grid.ColumnSpan="2"
|
||||
Margin="0"
|
||||
ClickMode="Press"
|
||||
Focusable="False"
|
||||
Foreground="{TemplateBinding Foreground}"
|
||||
Grid.Column="0"
|
||||
Grid.ColumnSpan="2"
|
||||
IsChecked="{Binding Path=IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
|
||||
Margin="0"
|
||||
Name="ToggleButton"
|
||||
Style="{StaticResource DefaultComboBoxToggleButtonStyle}" />
|
||||
<TextBox
|
||||
x:Name="PART_EditableTextBox"
|
||||
Grid.Column="0"
|
||||
Margin="{TemplateBinding Padding}"
|
||||
FontSize="{TemplateBinding FontSize}"
|
||||
Foreground="{TemplateBinding Foreground}"
|
||||
Grid.Column="0"
|
||||
IsReadOnly="{TemplateBinding IsReadOnly}"
|
||||
Style="{StaticResource DefaultComboBoxTextBoxStyle}" />
|
||||
Margin="{TemplateBinding Padding}"
|
||||
Style="{StaticResource DefaultComboBoxTextBoxStyle}"
|
||||
x:Name="PART_EditableTextBox" />
|
||||
<controls:SymbolIcon
|
||||
x:Name="ChevronIcon"
|
||||
Grid.Column="1"
|
||||
Margin="{StaticResource ComboBoxChevronMargin}"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="{StaticResource ComboBoxChevronSize}"
|
||||
Foreground="{DynamicResource ComboBoxDropDownGlyphForeground}"
|
||||
Foreground="{DynamicResource TextFillColorSecondaryBrush}"
|
||||
Grid.Column="1"
|
||||
IsHitTestVisible="False"
|
||||
Margin="{StaticResource ComboBoxChevronMargin}"
|
||||
RenderTransformOrigin="0.5, 0.5"
|
||||
Symbol="ChevronDown24">
|
||||
Symbol="ChevronDown24"
|
||||
VerticalAlignment="Center"
|
||||
x:Name="ChevronIcon">
|
||||
<controls:SymbolIcon.RenderTransform>
|
||||
<RotateTransform Angle="0" />
|
||||
</controls:SymbolIcon.RenderTransform>
|
||||
@@ -150,38 +145,38 @@
|
||||
</Grid>
|
||||
<!-- 弹出式菜单 -->
|
||||
<Popup
|
||||
x:Name="PART_Popup"
|
||||
MinWidth="{TemplateBinding ActualWidth}"
|
||||
VerticalAlignment="Center"
|
||||
AllowsTransparency="True"
|
||||
Focusable="False"
|
||||
IsOpen="{TemplateBinding IsDropDownOpen}"
|
||||
MinWidth="{TemplateBinding ActualWidth}"
|
||||
Placement="{TemplateBinding Popup.Placement}"
|
||||
PopupAnimation="{TemplateBinding Popup.PopupAnimation}"
|
||||
VerticalOffset="1">
|
||||
VerticalAlignment="Center"
|
||||
VerticalOffset="1"
|
||||
x:Name="PART_Popup">
|
||||
<Border
|
||||
x:Name="DropDownBorder"
|
||||
Background="{DynamicResource ComboBoxDropDownBackground}"
|
||||
BorderBrush="{DynamicResource ComboBoxDropDownBorderBrush}"
|
||||
Background="{DynamicResource AcrylicBackgroundFillColorDefaultBrush}"
|
||||
BorderBrush="{DynamicResource SurfaceStrokeColorDefaultBrush}"
|
||||
BorderThickness="1"
|
||||
CornerRadius="{StaticResource PopupCornerRadius}"
|
||||
Padding="0,4,0,6"
|
||||
SnapsToDevicePixels="True">
|
||||
SnapsToDevicePixels="True"
|
||||
x:Name="DropDownBorder">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid Margin="5,2,5,2" Visibility="{Binding ShowFilterBox, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource BooleanToVisConverter}}">
|
||||
<TextBox x:Name="PART_FilterTextBox"/>
|
||||
<TextBox x:Name="PART_FilterTextBox" />
|
||||
<TextBlock
|
||||
VerticalAlignment="Center"
|
||||
Foreground="{DynamicResource TextControlPlaceholderForeground}"
|
||||
FontSize="{TemplateBinding FontSize}"
|
||||
Foreground="{DynamicResource TextFillColorSecondaryBrush}"
|
||||
IsHitTestVisible="False"
|
||||
Name="FilterPlaceholderTextBlock"
|
||||
Padding="14,0"
|
||||
Text="{TemplateBinding FilterBoxPlaceholderText}"
|
||||
TextBlock.FontSize="{TemplateBinding FontSize}"
|
||||
VerticalAlignment="Center"
|
||||
Visibility="Collapsed" />
|
||||
</Grid>
|
||||
<!--<controls:TextBox
|
||||
@@ -191,9 +186,9 @@
|
||||
Visibility="{Binding ShowFilterBox, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource BooleanToVisConverter}}" />-->
|
||||
<controls:DynamicScrollViewer
|
||||
Grid.Row="1"
|
||||
MaxHeight="{TemplateBinding MaxDropDownHeight}"
|
||||
Margin="0"
|
||||
HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}"
|
||||
Margin="0"
|
||||
MaxHeight="{TemplateBinding MaxDropDownHeight}"
|
||||
SnapsToDevicePixels="True"
|
||||
TextElement.FontSize="{TemplateBinding FontSize}"
|
||||
TextElement.FontWeight="{TemplateBinding FontWeight}"
|
||||
@@ -249,33 +244,33 @@
|
||||
</BeginStoryboard>
|
||||
</Trigger.ExitActions>
|
||||
</Trigger>
|
||||
<Trigger Property="Text" Value="" SourceName="PART_FilterTextBox">
|
||||
<Setter TargetName="FilterPlaceholderTextBlock" Property="Visibility" Value="Visible" />
|
||||
<Trigger Property="Text" SourceName="PART_FilterTextBox" Value="">
|
||||
<Setter Property="Visibility" TargetName="FilterPlaceholderTextBlock" Value="Visible" />
|
||||
</Trigger>
|
||||
<Trigger Property="Header" Value="{x:Null}">
|
||||
<Setter TargetName="Header_TextBlock" Property="Margin" Value="0" />
|
||||
<Setter TargetName="Header_TextBlock" Property="Visibility" Value="Collapsed" />
|
||||
<Setter Property="Margin" TargetName="Header_TextBlock" Value="0" />
|
||||
<Setter Property="Visibility" TargetName="Header_TextBlock" Value="Collapsed" />
|
||||
</Trigger>
|
||||
<!-- 标题左右对齐时,控制最小宽度 -->
|
||||
<Trigger Property="HeaderPlacement" Value="Left">
|
||||
<Setter TargetName="Grid" Property="MinWidth" Value="80" />
|
||||
<Setter Property="MinWidth" TargetName="Grid" Value="80" />
|
||||
</Trigger>
|
||||
<Trigger Property="HeaderPlacement" Value="Right">
|
||||
<Setter TargetName="Grid" Property="MinWidth" Value="80" />
|
||||
<Setter Property="MinWidth" TargetName="Grid" Value="80" />
|
||||
</Trigger>
|
||||
<Trigger Property="HasItems" Value="False">
|
||||
<Setter TargetName="DropDownBorder" Property="MinHeight" Value="{StaticResource ComboBoxPopupMinHeight}" />
|
||||
<Setter Property="MinHeight" TargetName="DropDownBorder" Value="{StaticResource ComboBoxPopupMinHeight}" />
|
||||
</Trigger>
|
||||
<Trigger Property="Popup.AllowsTransparency" Value="False" SourceName="PART_Popup">
|
||||
<Setter TargetName="DropDownBorder" Property="CornerRadius" Value="0" />
|
||||
<Trigger Property="Popup.AllowsTransparency" SourceName="PART_Popup" Value="False">
|
||||
<Setter Property="CornerRadius" TargetName="DropDownBorder" Value="0" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsGrouping" Value="True">
|
||||
<Setter Property="ScrollViewer.CanContentScroll" Value="False" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsEditable" Value="True">
|
||||
<Setter Property="IsTabStop" Value="False" />
|
||||
<Setter TargetName="PART_EditableTextBox" Property="Visibility" Value="Visible" />
|
||||
<Setter TargetName="PART_ContentPresenter" Property="Visibility" Value="Hidden" />
|
||||
<Setter Property="Visibility" TargetName="PART_EditableTextBox" Value="Visible" />
|
||||
<Setter Property="Visibility" TargetName="PART_ContentPresenter" Value="Hidden" />
|
||||
</Trigger>
|
||||
<MultiTrigger>
|
||||
<MultiTrigger.Conditions>
|
||||
@@ -283,8 +278,8 @@
|
||||
<Condition Property="IsKeyboardFocusWithin" Value="True" />
|
||||
<Condition Property="IsEditable" Value="True" />
|
||||
</MultiTrigger.Conditions>
|
||||
<Setter TargetName="ContentBorder" Property="Background" Value="{DynamicResource ComboBoxBackgroundFocused}" />
|
||||
<Setter TargetName="AccentBorder" Property="Visibility" Value="Visible" />
|
||||
<Setter Property="Background" TargetName="ContentBorder" Value="{DynamicResource ControlFillColorDefaultBrush}" />
|
||||
<Setter Property="Visibility" TargetName="AccentBorder" Value="Visible" />
|
||||
</MultiTrigger>
|
||||
<!-- 可用、指针进入、键盘不聚焦 -->
|
||||
<MultiTrigger>
|
||||
@@ -293,7 +288,7 @@
|
||||
<Condition Property="IsMouseOver" Value="True" />
|
||||
<Condition Property="IsKeyboardFocusWithin" Value="False" />
|
||||
</MultiTrigger.Conditions>
|
||||
<Setter TargetName="ContentBorder" Property="Background" Value="{DynamicResource ComboBoxBackgroundPointerOver}" />
|
||||
<Setter Property="Background" TargetName="ContentBorder" Value="{DynamicResource ControlFillColorSecondaryBrush}" />
|
||||
</MultiTrigger>
|
||||
<!-- 选中项文本 -->
|
||||
<!--<MultiTrigger>
|
||||
@@ -312,7 +307,7 @@
|
||||
</MultiTrigger>-->
|
||||
|
||||
<Trigger Property="Text" Value="">
|
||||
<Setter TargetName="PlaceholderTextBlock" Property="Visibility" Value="Visible" />
|
||||
<Setter Property="Visibility" TargetName="PlaceholderTextBlock" Value="Visible" />
|
||||
</Trigger>
|
||||
<!--<Trigger Property="SelectedItem" Value="{x:Null}">
|
||||
<Setter TargetName="PlaceholderTextBlock" Property="Visibility" Value="Visible" />
|
||||
@@ -324,11 +319,11 @@
|
||||
<Setter TargetName="PlaceholderTextBlock" Property="Visibility" Value="Visible" />
|
||||
</DataTrigger>-->
|
||||
<Trigger Property="IsEnabled" Value="False">
|
||||
<Setter TargetName="ContentBorder" Property="Background" Value="{DynamicResource ComboBoxBackgroundDisabled}" />
|
||||
<Setter TargetName="ContentBorder" Property="BorderBrush" Value="{DynamicResource ComboBoxBorderBrushDisabled}" />
|
||||
<Setter Property="Foreground" Value="{DynamicResource ComboBoxForegroundDisabled}" />
|
||||
<Setter Property="Background" TargetName="ContentBorder" Value="{DynamicResource ControlFillColorDisabledBrush}" />
|
||||
<Setter Property="BorderBrush" TargetName="ContentBorder" Value="{DynamicResource ControlStrokeColorDefaultBrush}" />
|
||||
<Setter Property="Foreground" Value="{DynamicResource TextFillColorDisabledBrush}" />
|
||||
<!--#region Extend 水印-->
|
||||
<Setter TargetName="PlaceholderTextBlock" Property="Foreground" Value="{DynamicResource TextControlForegroundDisabled}" />
|
||||
<Setter Property="Foreground" TargetName="PlaceholderTextBlock" Value="{DynamicResource TextFillColorDisabledBrush}" />
|
||||
<!--#endregion-->
|
||||
</Trigger>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user