整理代码

This commit is contained in:
GG Z
2026-02-20 15:31:44 +08:00
parent 94cf3f3266
commit 9f121cfc7f
149 changed files with 4063 additions and 6964 deletions

View File

@@ -1,13 +1,13 @@
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:assists="clr-namespace:Melskin.Assists"
xmlns:controls="clr-namespace:Melskin.Controls"
xmlns:converters="clr-namespace:Melskin.Converters"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
xmlns:converters="clr-namespace:Melskin.Converters">
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/Melskin;component/Controls/ComboBox.xaml" />
</ResourceDictionary.MergedDictionaries>
<Style TargetType="{x:Type ListBoxItem}" x:Key="MultiComboBoxItemStyle">
<Style x:Key="MultiComboBoxItemStyle" TargetType="{x:Type ListBoxItem}">
<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}}}" />
@@ -21,28 +21,28 @@
<Grid>
<!--<ContentPresenter HorizontalAlignment="Left" VerticalAlignment="Center" />-->
<Border
x:Name="Bd"
Padding="{TemplateBinding Padding}"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="4"
Padding="{TemplateBinding Padding}"
SnapsToDevicePixels="True"
x:Name="Bd">
SnapsToDevicePixels="True">
<ContentPresenter
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
</Border>
<Border
x:Name="Indicator"
CornerRadius="4"
Visibility="Hidden"
x:Name="Indicator">
Visibility="Hidden">
<Border
Background="{DynamicResource PrimaryNormalBrush}"
CornerRadius="2"
HorizontalAlignment="Left"
Width="4"
Margin="2,4"
Width="4" />
HorizontalAlignment="Left"
Background="{DynamicResource PrimaryNormalBrush}"
CornerRadius="2" />
</Border>
<!--<controls:IconElement
x:Name="CheckMark"
@@ -55,11 +55,11 @@
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter Property="Background" TargetName="Bd" Value="{DynamicResource ControlBackgroundSelectedBrush}" />
<Setter Property="Visibility" TargetName="Indicator" Value="Visible" />
<Setter TargetName="Bd" Property="Background" Value="{DynamicResource ControlBackgroundSelectedBrush}" />
<Setter TargetName="Indicator" Property="Visibility" Value="Visible" />
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" TargetName="Bd" Value="{DynamicResource ControlBackgroundHoverBrush}" />
<Setter TargetName="Bd" Property="Background" Value="{DynamicResource ControlBackgroundHoverBrush}" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
@@ -90,30 +90,30 @@
<ColumnDefinition Width="10" />
</Grid.ColumnDefinitions>
<ToggleButton
x:Name="PART_ToggleButton"
Grid.Column="0"
Grid.ColumnSpan="2"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
Grid.Column="0"
Grid.ColumnSpan="2"
IsChecked="{Binding IsDropDownOpen, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}"
Style="{DynamicResource ComboBoxToggleButton}"
x:Name="PART_ToggleButton" />
Style="{DynamicResource ComboBoxToggleButton}" />
<Grid
ClipToBounds="True"
x:Name="templateRoot"
Grid.Column="0"
Margin="{TemplateBinding BorderThickness}"
VerticalAlignment="Center"
x:Name="templateRoot">
ClipToBounds="True">
<!-- 占位符 水印 -->
<TextBlock
Foreground="{DynamicResource TextPlaceholderBrush}"
IsHitTestVisible="False"
x:Name="PlaceholderTextBlock"
Margin="{TemplateBinding BorderThickness}"
Padding="{TemplateBinding Padding}"
Text="{Binding PlaceHolderText, RelativeSource={RelativeSource AncestorType=controls:MultiComboBox}}"
VerticalAlignment="Center"
x:Name="PlaceholderTextBlock">
Foreground="{DynamicResource TextPlaceholderBrush}"
IsHitTestVisible="False"
Text="{Binding PlaceHolderText, RelativeSource={RelativeSource AncestorType=controls:MultiComboBox}}">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Visibility" Value="Collapsed" />
@@ -142,7 +142,7 @@
<!-- 多选 Tag 列表 -->
<!--<ItemsControl x:Name="TagItemsControl" ItemsSource="{Binding SelectedItems, Mode=OneWay, RelativeSource={RelativeSource AncestorType=local:NeuComboBox}}">-->
<ItemsControl ItemsSource="{Binding ElementName=PART_ListBox, Path=SelectedItems}" x:Name="TagItemsControl">
<ItemsControl x:Name="TagItemsControl" ItemsSource="{Binding ElementName=PART_ListBox, Path=SelectedItems}">
<ItemsControl.Style>
<Style TargetType="ItemsControl">
<Setter Property="Visibility" Value="Collapsed" />
@@ -169,43 +169,43 @@
<ItemsControl.ItemTemplate>
<DataTemplate>
<controls:Tag
Margin="1"
Closable="True"
Content="{Binding}"
Margin="1" />
Content="{Binding}" />
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
<ContentPresenter
Margin="{TemplateBinding Padding}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
Content="{Binding SelectedItem, RelativeSource={RelativeSource AncestorType=controls:MultiComboBox}}"
ContentStringFormat="{Binding DisplayMemberPath, RelativeSource={RelativeSource TemplatedParent}}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
IsHitTestVisible="False"
Margin="{TemplateBinding Padding}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
Visibility="{Binding SelectionMode, RelativeSource={RelativeSource AncestorType=controls:MultiComboBox}, Converter={x:Static converters:ComparisionToVisibilityConverter.Instance}, ConverterParameter={x:Static SelectionMode.Single}}" />
</Grid>
<Popup
AllowsTransparency="True"
x:Name="dropDownBorder"
Grid.Column="0"
IsOpen="{Binding IsDropDownOpen, RelativeSource={RelativeSource TemplatedParent}}"
Margin="-8"
MinWidth="{Binding ActualWidth, ElementName=PART_ToggleButton}"
Margin="-8"
assists:BehaviorAssist.SimulateNativeBehavior="True"
AllowsTransparency="True"
IsOpen="{Binding IsDropDownOpen, RelativeSource={RelativeSource TemplatedParent}}"
Placement="Bottom"
PlacementTarget="{Binding ElementName=PART_ToggleButton}"
PopupAnimation="Slide"
StaysOpen="True"
VerticalOffset="4"
assists:BehaviorAssist.SimulateNativeBehavior="True"
x:Name="dropDownBorder">
VerticalOffset="4">
<Border
MinWidth="{Binding ActualWidth, ElementName=templateRoot}"
MaxHeight="{TemplateBinding MaxDropDownHeight}"
Margin="8"
Background="{DynamicResource BackgroundLayoutBrush}"
BorderBrush="{DynamicResource BorderNormalBrush}"
BorderThickness="1"
CornerRadius="4"
Effect="{DynamicResource PopupShadow}"
Margin="8"
MaxHeight="{TemplateBinding MaxDropDownHeight}"
MinWidth="{Binding ActualWidth, ElementName=templateRoot}">
Effect="{DynamicResource PopupShadow}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
@@ -215,32 +215,32 @@
</Grid.RowDefinitions>
<TextBox
x:Name="PART_FilterTextBox"
Grid.Row="0"
Margin="6,6,6,2"
Padding="4,2"
Text="{Binding FilterText, RelativeSource={RelativeSource TemplatedParent}, UpdateSourceTrigger=PropertyChanged}"
VerticalAlignment="Top"
Visibility="{Binding IsFilteringEnabled, RelativeSource={RelativeSource TemplatedParent}, Converter={x:Static converters:BooleanToVisibilityConverter.CollapsedInstance}}"
assists:InputAssist.Clearable="{TemplateBinding assists:InputAssist.Clearable}"
x:Name="PART_FilterTextBox">
Text="{Binding FilterText, RelativeSource={RelativeSource TemplatedParent}, UpdateSourceTrigger=PropertyChanged}"
Visibility="{Binding IsFilteringEnabled, RelativeSource={RelativeSource TemplatedParent}, Converter={x:Static converters:BooleanToVisibilityConverter.CollapsedInstance}}">
<assists:InputAssist.Suffix>
<controls:IconElement
Foreground="{DynamicResource TextSecondaryBrush}"
Width="16"
Height="16"
Margin="4,2,2,0"
Symbol="Search"
Width="16" />
Foreground="{DynamicResource TextSecondaryBrush}"
Symbol="Search" />
</assists:InputAssist.Suffix>
</TextBox>
<ListBox
x:Name="PART_ListBox"
Grid.Row="1"
Background="{DynamicResource BackgroundFloatingBrush}"
BorderThickness="0"
DisplayMemberPath="{Binding DisplayMemberPath, RelativeSource={RelativeSource TemplatedParent}}"
Grid.Row="1"
ItemContainerStyle="{StaticResource MultiComboBoxItemStyle}"
ItemsSource="{Binding FilteredItems, RelativeSource={RelativeSource TemplatedParent}}"
SelectionMode="{Binding SelectionMode, RelativeSource={RelativeSource TemplatedParent}}"
x:Name="PART_ListBox" />
SelectionMode="{Binding SelectionMode, RelativeSource={RelativeSource TemplatedParent}}" />
</Grid>
</Border>
</Popup>