2025-08-20 12:10:13 +08:00
|
|
|
|
<ResourceDictionary
|
|
|
|
|
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
2026-01-02 17:30:30 +08:00
|
|
|
|
xmlns:assists="clr-namespace:VariaStudio.Assists"
|
|
|
|
|
|
xmlns:controls="clr-namespace:VariaStudio.Controls"
|
|
|
|
|
|
xmlns:converters="clr-namespace:VariaStudio.Converters"
|
|
|
|
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
2025-08-20 12:10:13 +08:00
|
|
|
|
<ResourceDictionary.MergedDictionaries>
|
2026-01-02 17:30:30 +08:00
|
|
|
|
<ResourceDictionary Source="/VariaStudio;component/Controls/ComboBox.xaml" />
|
2025-08-20 12:10:13 +08:00
|
|
|
|
</ResourceDictionary.MergedDictionaries>
|
2026-01-02 17:30:30 +08:00
|
|
|
|
<Style TargetType="{x:Type ListBoxItem}" x:Key="MultiComboBoxItemStyle">
|
2025-08-20 12:10:13 +08:00
|
|
|
|
<Setter Property="SnapsToDevicePixels" Value="True" />
|
2025-12-23 21:35:54 +08:00
|
|
|
|
<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}}}" />
|
2025-08-20 12:10:13 +08:00
|
|
|
|
<Setter Property="Background" Value="Transparent" />
|
2025-12-23 21:35:54 +08:00
|
|
|
|
<Setter Property="BorderBrush" Value="Transparent" />
|
|
|
|
|
|
<Setter Property="FocusVisualStyle" Value="{DynamicResource FocusVisual}" />
|
2025-08-20 12:10:13 +08:00
|
|
|
|
<Setter Property="Template">
|
|
|
|
|
|
<Setter.Value>
|
|
|
|
|
|
<ControlTemplate TargetType="{x:Type ListBoxItem}">
|
2025-12-23 21:35:54 +08:00
|
|
|
|
<Grid>
|
|
|
|
|
|
<!--<ContentPresenter HorizontalAlignment="Left" VerticalAlignment="Center" />-->
|
|
|
|
|
|
<Border
|
|
|
|
|
|
Background="{TemplateBinding Background}"
|
|
|
|
|
|
BorderBrush="{TemplateBinding BorderBrush}"
|
|
|
|
|
|
BorderThickness="{TemplateBinding BorderThickness}"
|
|
|
|
|
|
CornerRadius="4"
|
2026-01-02 17:30:30 +08:00
|
|
|
|
Padding="{TemplateBinding Padding}"
|
|
|
|
|
|
SnapsToDevicePixels="True"
|
|
|
|
|
|
x:Name="Bd">
|
2025-12-23 21:35:54 +08:00
|
|
|
|
<ContentPresenter
|
|
|
|
|
|
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
2026-01-02 17:30:30 +08:00
|
|
|
|
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
|
|
|
|
|
|
VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
|
2025-12-23 21:35:54 +08:00
|
|
|
|
</Border>
|
|
|
|
|
|
<Border
|
|
|
|
|
|
CornerRadius="4"
|
2026-01-02 17:30:30 +08:00
|
|
|
|
Visibility="Hidden"
|
|
|
|
|
|
x:Name="Indicator">
|
2025-12-23 21:35:54 +08:00
|
|
|
|
<Border
|
|
|
|
|
|
Background="{DynamicResource PrimaryNormalBrush}"
|
2026-01-02 17:30:30 +08:00
|
|
|
|
CornerRadius="2"
|
|
|
|
|
|
HorizontalAlignment="Left"
|
|
|
|
|
|
Margin="2,4"
|
|
|
|
|
|
Width="4" />
|
2025-12-23 21:35:54 +08:00
|
|
|
|
</Border>
|
|
|
|
|
|
<!--<controls:IconElement
|
|
|
|
|
|
x:Name="CheckMark"
|
|
|
|
|
|
HorizontalAlignment="Right"
|
|
|
|
|
|
VerticalAlignment="Center"
|
|
|
|
|
|
FontWeight="Bold"
|
|
|
|
|
|
Foreground="{DynamicResource PrimaryNormalBrush}"
|
|
|
|
|
|
Symbol="Check"
|
|
|
|
|
|
Visibility="Collapsed" />-->
|
|
|
|
|
|
</Grid>
|
2025-08-20 12:10:13 +08:00
|
|
|
|
<ControlTemplate.Triggers>
|
|
|
|
|
|
<Trigger Property="IsSelected" Value="True">
|
2026-01-02 17:30:30 +08:00
|
|
|
|
<Setter Property="Background" TargetName="Bd" Value="{DynamicResource ControlBackgroundSelectedBrush}" />
|
|
|
|
|
|
<Setter Property="Visibility" TargetName="Indicator" Value="Visible" />
|
2025-08-20 12:10:13 +08:00
|
|
|
|
</Trigger>
|
|
|
|
|
|
<Trigger Property="IsMouseOver" Value="True">
|
2026-01-02 17:30:30 +08:00
|
|
|
|
<Setter Property="Background" TargetName="Bd" Value="{DynamicResource ControlBackgroundHoverBrush}" />
|
2025-08-20 12:10:13 +08:00
|
|
|
|
</Trigger>
|
|
|
|
|
|
</ControlTemplate.Triggers>
|
|
|
|
|
|
</ControlTemplate>
|
|
|
|
|
|
</Setter.Value>
|
|
|
|
|
|
</Setter>
|
|
|
|
|
|
</Style>
|
|
|
|
|
|
|
2025-12-23 21:35:54 +08:00
|
|
|
|
<Style TargetType="{x:Type controls:MultiComboBox}">
|
2025-08-20 12:10:13 +08:00
|
|
|
|
<Setter Property="VerticalContentAlignment" Value="Center" />
|
|
|
|
|
|
<Setter Property="Background" Value="{DynamicResource ControlBackgroundNormalBrush}" />
|
2025-12-23 21:35:54 +08:00
|
|
|
|
<Setter Property="BorderBrush" Value="Transparent" />
|
2025-08-20 12:10:13 +08:00
|
|
|
|
<Setter Property="Foreground" Value="{DynamicResource TextPrimaryBrush}" />
|
|
|
|
|
|
<Setter Property="BorderThickness" Value="1" />
|
2025-12-23 21:35:54 +08:00
|
|
|
|
<Setter Property="Padding" Value="12,8" />
|
2025-08-20 12:10:13 +08:00
|
|
|
|
<Setter Property="VerticalAlignment" Value="Center" />
|
|
|
|
|
|
<Setter Property="assists:InputAssist.Clearable" Value="True" />
|
|
|
|
|
|
<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">
|
|
|
|
|
|
<Setter.Value>
|
2025-12-23 21:35:54 +08:00
|
|
|
|
<ControlTemplate TargetType="{x:Type controls:MultiComboBox}">
|
2025-08-20 12:10:13 +08:00
|
|
|
|
<Grid>
|
2025-09-08 19:49:09 +08:00
|
|
|
|
<Grid.ColumnDefinitions>
|
|
|
|
|
|
<ColumnDefinition Width="*" />
|
|
|
|
|
|
<ColumnDefinition Width="10" />
|
|
|
|
|
|
</Grid.ColumnDefinitions>
|
2025-08-20 12:10:13 +08:00
|
|
|
|
<ToggleButton
|
|
|
|
|
|
Background="{TemplateBinding Background}"
|
|
|
|
|
|
BorderBrush="{TemplateBinding BorderBrush}"
|
|
|
|
|
|
BorderThickness="{TemplateBinding BorderThickness}"
|
2026-01-02 17:30:30 +08:00
|
|
|
|
Grid.Column="0"
|
|
|
|
|
|
Grid.ColumnSpan="2"
|
2025-08-20 12:10:13 +08:00
|
|
|
|
IsChecked="{Binding IsDropDownOpen, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}"
|
2026-01-02 17:30:30 +08:00
|
|
|
|
Style="{DynamicResource ComboBoxToggleButton}"
|
|
|
|
|
|
x:Name="PART_ToggleButton" />
|
2025-09-08 19:49:09 +08:00
|
|
|
|
<Grid
|
2026-01-02 17:30:30 +08:00
|
|
|
|
ClipToBounds="True"
|
2025-09-08 19:49:09 +08:00
|
|
|
|
Grid.Column="0"
|
2025-12-23 21:35:54 +08:00
|
|
|
|
Margin="{TemplateBinding BorderThickness}"
|
2025-09-08 19:49:09 +08:00
|
|
|
|
VerticalAlignment="Center"
|
2026-01-02 17:30:30 +08:00
|
|
|
|
x:Name="templateRoot">
|
2025-08-20 12:10:13 +08:00
|
|
|
|
|
2025-09-08 19:49:09 +08:00
|
|
|
|
<!-- 占位符 水印 -->
|
|
|
|
|
|
<TextBlock
|
2026-01-02 17:30:30 +08:00
|
|
|
|
Foreground="{DynamicResource TextPlaceholderBrush}"
|
|
|
|
|
|
IsHitTestVisible="False"
|
2025-12-23 21:35:54 +08:00
|
|
|
|
Margin="{TemplateBinding BorderThickness}"
|
|
|
|
|
|
Padding="{TemplateBinding Padding}"
|
2026-01-02 17:30:30 +08:00
|
|
|
|
Text="{Binding PlaceHolderText, RelativeSource={RelativeSource AncestorType=controls:MultiComboBox}}"
|
2025-12-23 21:35:54 +08:00
|
|
|
|
VerticalAlignment="Center"
|
2026-01-02 17:30:30 +08:00
|
|
|
|
x:Name="PlaceholderTextBlock">
|
2025-09-08 19:49:09 +08:00
|
|
|
|
<TextBlock.Style>
|
|
|
|
|
|
<Style TargetType="TextBlock">
|
|
|
|
|
|
<Setter Property="Visibility" Value="Collapsed" />
|
|
|
|
|
|
<Style.Triggers>
|
|
|
|
|
|
<!-- 多选:无标签 -->
|
|
|
|
|
|
<MultiDataTrigger>
|
|
|
|
|
|
<MultiDataTrigger.Conditions>
|
2025-12-23 21:35:54 +08:00
|
|
|
|
<Condition Binding="{Binding SelectionMode, RelativeSource={RelativeSource AncestorType=controls:MultiComboBox}}" Value="{x:Static SelectionMode.Multiple}" />
|
2025-09-08 19:49:09 +08:00
|
|
|
|
<Condition Binding="{Binding HasItems, ElementName=TagItemsControl}" Value="False" />
|
|
|
|
|
|
<!--<Condition Binding="{Binding SelectedItems.Count, RelativeSource={RelativeSource AncestorType=local:NeuComboBox}, TargetNullValue=0}" Value="0" />-->
|
|
|
|
|
|
</MultiDataTrigger.Conditions>
|
|
|
|
|
|
<Setter Property="Visibility" Value="Visible" />
|
|
|
|
|
|
</MultiDataTrigger>
|
|
|
|
|
|
<!-- 单选:未选 -->
|
|
|
|
|
|
<MultiDataTrigger>
|
|
|
|
|
|
<MultiDataTrigger.Conditions>
|
2025-12-23 21:35:54 +08:00
|
|
|
|
<Condition Binding="{Binding SelectionMode, RelativeSource={RelativeSource AncestorType=controls:MultiComboBox}}" Value="{x:Static SelectionMode.Single}" />
|
|
|
|
|
|
<Condition Binding="{Binding SelectedItem, RelativeSource={RelativeSource AncestorType=controls:MultiComboBox}}" Value="{x:Null}" />
|
2025-09-08 19:49:09 +08:00
|
|
|
|
</MultiDataTrigger.Conditions>
|
|
|
|
|
|
<Setter Property="Visibility" Value="Visible" />
|
|
|
|
|
|
</MultiDataTrigger>
|
|
|
|
|
|
</Style.Triggers>
|
|
|
|
|
|
</Style>
|
|
|
|
|
|
</TextBlock.Style>
|
|
|
|
|
|
</TextBlock>
|
2025-08-20 12:10:13 +08:00
|
|
|
|
|
2025-09-08 19:49:09 +08:00
|
|
|
|
<!-- 多选 Tag 列表 -->
|
|
|
|
|
|
<!--<ItemsControl x:Name="TagItemsControl" ItemsSource="{Binding SelectedItems, Mode=OneWay, RelativeSource={RelativeSource AncestorType=local:NeuComboBox}}">-->
|
2026-01-02 17:30:30 +08:00
|
|
|
|
<ItemsControl ItemsSource="{Binding ElementName=PART_ListBox, Path=SelectedItems}" x:Name="TagItemsControl">
|
2025-09-08 19:49:09 +08:00
|
|
|
|
<ItemsControl.Style>
|
|
|
|
|
|
<Style TargetType="ItemsControl">
|
|
|
|
|
|
<Setter Property="Visibility" Value="Collapsed" />
|
|
|
|
|
|
<Style.Triggers>
|
2025-12-23 21:35:54 +08:00
|
|
|
|
<DataTrigger Binding="{Binding SelectionMode, RelativeSource={RelativeSource AncestorType=controls:MultiComboBox}}" Value="{x:Static SelectionMode.Multiple}">
|
2025-09-08 19:49:09 +08:00
|
|
|
|
<Setter Property="Visibility" Value="Visible" />
|
|
|
|
|
|
</DataTrigger>
|
|
|
|
|
|
</Style.Triggers>
|
|
|
|
|
|
</Style>
|
|
|
|
|
|
</ItemsControl.Style>
|
|
|
|
|
|
<!-- 标签滚动,但是有bug 影响选择 -->
|
|
|
|
|
|
<!--<ItemsControl.Template>
|
|
|
|
|
|
<ControlTemplate>
|
|
|
|
|
|
<ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto">
|
|
|
|
|
|
<ItemsPresenter />
|
|
|
|
|
|
</ScrollViewer>
|
|
|
|
|
|
</ControlTemplate>
|
|
|
|
|
|
</ItemsControl.Template>-->
|
|
|
|
|
|
<ItemsControl.ItemsPanel>
|
|
|
|
|
|
<ItemsPanelTemplate>
|
|
|
|
|
|
<WrapPanel IsItemsHost="True" />
|
|
|
|
|
|
</ItemsPanelTemplate>
|
|
|
|
|
|
</ItemsControl.ItemsPanel>
|
|
|
|
|
|
<ItemsControl.ItemTemplate>
|
|
|
|
|
|
<DataTemplate>
|
|
|
|
|
|
<controls:Tag
|
|
|
|
|
|
Closable="True"
|
2026-01-02 17:30:30 +08:00
|
|
|
|
Content="{Binding}"
|
|
|
|
|
|
Margin="1" />
|
2025-09-08 19:49:09 +08:00
|
|
|
|
</DataTemplate>
|
|
|
|
|
|
</ItemsControl.ItemTemplate>
|
|
|
|
|
|
</ItemsControl>
|
|
|
|
|
|
<ContentPresenter
|
2025-12-23 21:35:54 +08:00
|
|
|
|
Content="{Binding SelectedItem, RelativeSource={RelativeSource AncestorType=controls:MultiComboBox}}"
|
|
|
|
|
|
ContentStringFormat="{Binding DisplayMemberPath, RelativeSource={RelativeSource TemplatedParent}}"
|
2026-01-02 17:30:30 +08:00
|
|
|
|
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
2025-12-23 21:35:54 +08:00
|
|
|
|
IsHitTestVisible="False"
|
2026-01-02 17:30:30 +08:00
|
|
|
|
Margin="{TemplateBinding Padding}"
|
|
|
|
|
|
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
2025-12-23 21:35:54 +08:00
|
|
|
|
Visibility="{Binding SelectionMode, RelativeSource={RelativeSource AncestorType=controls:MultiComboBox}, Converter={x:Static converters:ComparisionToVisibilityConverter.Instance}, ConverterParameter={x:Static SelectionMode.Single}}" />
|
2025-08-20 12:10:13 +08:00
|
|
|
|
</Grid>
|
|
|
|
|
|
<Popup
|
2025-12-23 21:35:54 +08:00
|
|
|
|
AllowsTransparency="True"
|
2026-01-02 17:30:30 +08:00
|
|
|
|
Grid.Column="0"
|
2025-12-23 21:35:54 +08:00
|
|
|
|
IsOpen="{Binding IsDropDownOpen, RelativeSource={RelativeSource TemplatedParent}}"
|
2026-01-02 17:30:30 +08:00
|
|
|
|
Margin="-8"
|
|
|
|
|
|
MinWidth="{Binding ActualWidth, ElementName=PART_ToggleButton}"
|
2025-08-20 12:10:13 +08:00
|
|
|
|
Placement="Bottom"
|
2025-10-10 11:19:58 +08:00
|
|
|
|
PlacementTarget="{Binding ElementName=PART_ToggleButton}"
|
2025-08-20 12:10:13 +08:00
|
|
|
|
PopupAnimation="Slide"
|
2025-10-10 11:19:58 +08:00
|
|
|
|
StaysOpen="True"
|
2026-01-02 17:30:30 +08:00
|
|
|
|
VerticalOffset="4"
|
|
|
|
|
|
assists:BehaviorAssist.SimulateNativeBehavior="True"
|
|
|
|
|
|
x:Name="dropDownBorder">
|
2025-08-20 12:10:13 +08:00
|
|
|
|
<Border
|
|
|
|
|
|
Background="{DynamicResource BackgroundLayoutBrush}"
|
|
|
|
|
|
BorderBrush="{DynamicResource BorderNormalBrush}"
|
|
|
|
|
|
BorderThickness="1"
|
|
|
|
|
|
CornerRadius="4"
|
2026-01-02 17:30:30 +08:00
|
|
|
|
Effect="{DynamicResource PopupShadow}"
|
|
|
|
|
|
Margin="8"
|
|
|
|
|
|
MaxHeight="{TemplateBinding MaxDropDownHeight}"
|
|
|
|
|
|
MinWidth="{Binding ActualWidth, ElementName=templateRoot}">
|
2025-08-20 12:10:13 +08:00
|
|
|
|
<Grid>
|
|
|
|
|
|
<Grid.RowDefinitions>
|
|
|
|
|
|
<RowDefinition Height="Auto" />
|
|
|
|
|
|
<!-- 用于 TextBox -->
|
|
|
|
|
|
<RowDefinition Height="*" />
|
|
|
|
|
|
<!-- 用于 ListBox,占据剩余空间 -->
|
|
|
|
|
|
</Grid.RowDefinitions>
|
|
|
|
|
|
|
|
|
|
|
|
<TextBox
|
|
|
|
|
|
Grid.Row="0"
|
|
|
|
|
|
Margin="6,6,6,2"
|
|
|
|
|
|
Padding="4,2"
|
2026-01-02 17:30:30 +08:00
|
|
|
|
Text="{Binding FilterText, RelativeSource={RelativeSource TemplatedParent}, UpdateSourceTrigger=PropertyChanged}"
|
2025-08-20 12:10:13 +08:00
|
|
|
|
VerticalAlignment="Top"
|
2026-01-02 17:30:30 +08:00
|
|
|
|
Visibility="{Binding IsFilteringEnabled, RelativeSource={RelativeSource TemplatedParent}, Converter={x:Static converters:BooleanToVisibilityConverter.CollapsedInstance}}"
|
2025-08-20 12:10:13 +08:00
|
|
|
|
assists:InputAssist.Clearable="{TemplateBinding assists:InputAssist.Clearable}"
|
2026-01-02 17:30:30 +08:00
|
|
|
|
x:Name="PART_FilterTextBox">
|
2025-08-20 12:10:13 +08:00
|
|
|
|
<assists:InputAssist.Suffix>
|
2025-10-10 11:19:58 +08:00
|
|
|
|
<controls:IconElement
|
2026-01-02 17:30:30 +08:00
|
|
|
|
Foreground="{DynamicResource TextSecondaryBrush}"
|
2025-10-10 11:19:58 +08:00
|
|
|
|
Height="16"
|
|
|
|
|
|
Margin="4,2,2,0"
|
2026-01-02 17:30:30 +08:00
|
|
|
|
Symbol="Search"
|
|
|
|
|
|
Width="16" />
|
2025-08-20 12:10:13 +08:00
|
|
|
|
</assists:InputAssist.Suffix>
|
|
|
|
|
|
</TextBox>
|
|
|
|
|
|
<ListBox
|
2025-12-23 21:35:54 +08:00
|
|
|
|
Background="{DynamicResource BackgroundFloatingBrush}"
|
2025-08-20 12:10:13 +08:00
|
|
|
|
BorderThickness="0"
|
|
|
|
|
|
DisplayMemberPath="{Binding DisplayMemberPath, RelativeSource={RelativeSource TemplatedParent}}"
|
2026-01-02 17:30:30 +08:00
|
|
|
|
Grid.Row="1"
|
2025-12-23 21:35:54 +08:00
|
|
|
|
ItemContainerStyle="{StaticResource MultiComboBoxItemStyle}"
|
2025-08-20 12:10:13 +08:00
|
|
|
|
ItemsSource="{Binding FilteredItems, RelativeSource={RelativeSource TemplatedParent}}"
|
2026-01-02 17:30:30 +08:00
|
|
|
|
SelectionMode="{Binding SelectionMode, RelativeSource={RelativeSource TemplatedParent}}"
|
|
|
|
|
|
x:Name="PART_ListBox" />
|
2025-08-20 12:10:13 +08:00
|
|
|
|
</Grid>
|
|
|
|
|
|
</Border>
|
|
|
|
|
|
</Popup>
|
|
|
|
|
|
</Grid>
|
|
|
|
|
|
</ControlTemplate>
|
|
|
|
|
|
</Setter.Value>
|
|
|
|
|
|
</Setter>
|
|
|
|
|
|
</Style>
|
|
|
|
|
|
</ResourceDictionary>
|