267 lines
15 KiB
Plaintext
267 lines
15 KiB
Plaintext
![]() |
<ResourceDictionary
|
||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||
|
xmlns:local="clr-namespace:SWS.CustomControl;assembly=SWS.CustomControl"
|
||
|
xmlns:po="http://schemas.microsoft.com/winfx/2006/xaml/presentation/options"
|
||
|
xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation">
|
||
|
<!-- 系统颜色 -->
|
||
|
<SolidColorBrush x:Key="ColorPrimary" Color="#026BE3" />
|
||
|
<SolidColorBrush x:Key="ColorSecond" Color="#02ADFF" />
|
||
|
<SolidColorBrush x:Key="ColorOther" Color="#DBE0E4" />
|
||
|
|
||
|
<!-- 多选 Combox Start -->
|
||
|
<ExponentialEase x:Key="ExponentialEaseOut" EasingMode="EaseOut" />
|
||
|
<DropShadowEffect
|
||
|
x:Key="PopupShadowDepth"
|
||
|
BlurRadius="12"
|
||
|
Opacity="0.1"
|
||
|
ShadowDepth="2"
|
||
|
Color="Transparent" />
|
||
|
<Geometry x:Key="ChevronDownGeometry" po:Freeze="True">M998 352c0 -8 -4 -17 -10 -23l-50 -50c-6 -6 -14 -10 -23 -10c-8 0 -17 4 -23 10l-393 393l-393 -393c-6 -6 -15 -10 -23 -10s-17 4 -23 10l-50 50c-6 6 -10 15 -10 23s4 17 10 23l466 466c6 6 15 10 23 10s17 -4 23 -10l466 -466c6 -6 10 -15 10 -23z</Geometry>
|
||
|
<ControlTemplate x:Key="ComboBoxTextBox" TargetType="{x:Type TextBox}">
|
||
|
<Border
|
||
|
HorizontalAlignment="Left"
|
||
|
Background="{TemplateBinding Background}"
|
||
|
Focusable="False">
|
||
|
<ScrollViewer
|
||
|
x:Name="PART_ContentHost"
|
||
|
Background="Transparent"
|
||
|
Focusable="False"
|
||
|
HorizontalScrollBarVisibility="Hidden"
|
||
|
VerticalScrollBarVisibility="Hidden" />
|
||
|
</Border>
|
||
|
</ControlTemplate>
|
||
|
<ControlTemplate x:Key="ComboBoxToggleButton1" TargetType="{x:Type ToggleButton}">
|
||
|
<Border
|
||
|
x:Name="PART_Border"
|
||
|
Padding="1,1.2"
|
||
|
BorderThickness="0"
|
||
|
SnapsToDevicePixels="true">
|
||
|
<Grid Background="Transparent">
|
||
|
<Grid.ColumnDefinitions>
|
||
|
<ColumnDefinition Width="0.9*" />
|
||
|
<ColumnDefinition Width="0.1*" />
|
||
|
</Grid.ColumnDefinitions>
|
||
|
<Rectangle
|
||
|
Grid.Column="1"
|
||
|
Width="30"
|
||
|
Height="Auto"
|
||
|
Margin="0,1"
|
||
|
Fill="Transparent" />
|
||
|
<Path
|
||
|
x:Name="PART_Arrow"
|
||
|
Grid.Column="1"
|
||
|
Width="10"
|
||
|
Height="6"
|
||
|
HorizontalAlignment="Center"
|
||
|
VerticalAlignment="Center"
|
||
|
Data="M5,0 L10,10 L0,10 z"
|
||
|
Fill="#03ffea"
|
||
|
RenderTransformOrigin=".5,.5"
|
||
|
Stretch="Fill">
|
||
|
|
||
|
<Path.RenderTransform>
|
||
|
<RotateTransform Angle="180" />
|
||
|
</Path.RenderTransform>
|
||
|
</Path>
|
||
|
</Grid>
|
||
|
</Border>
|
||
|
</ControlTemplate>
|
||
|
|
||
|
<Style x:Key="DefaultMultiSelectComboBoxItem" TargetType="{x:Type local:MultiSelectComboBoxItem}">
|
||
|
<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="SnapsToDevicePixels" Value="True" />
|
||
|
<Setter Property="Background" Value="Transparent" />
|
||
|
<Setter Property="BorderBrush" Value="Transparent" />
|
||
|
<Setter Property="Foreground" Value="{DynamicResource RegularTextSolidColorBrush}" />
|
||
|
<Setter Property="BorderThickness" Value="0" />
|
||
|
<Setter Property="Height" Value="34" />
|
||
|
<Setter Property="Margin" Value="1,0" />
|
||
|
<Setter Property="Padding" Value="6,0" />
|
||
|
<Setter Property="Cursor" Value="Hand" />
|
||
|
<Setter Property="Template">
|
||
|
<Setter.Value>
|
||
|
<ControlTemplate TargetType="{x:Type local:MultiSelectComboBoxItem}">
|
||
|
|
||
|
<Border
|
||
|
x:Name="PART_Border"
|
||
|
Padding="{TemplateBinding Padding}"
|
||
|
Background="{TemplateBinding Background}"
|
||
|
BorderBrush="{TemplateBinding BorderBrush}"
|
||
|
BorderThickness="{TemplateBinding BorderThickness}"
|
||
|
SnapsToDevicePixels="true">
|
||
|
<CheckBox
|
||
|
Padding="{TemplateBinding Padding}"
|
||
|
HorizontalAlignment="Stretch"
|
||
|
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||
|
Foreground="{TemplateBinding Foreground}"
|
||
|
IsChecked="{Binding IsSelected, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}">
|
||
|
|
||
|
<ContentPresenter
|
||
|
x:Name="PART_ContentPresenter"
|
||
|
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||
|
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||
|
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
|
||
|
TextElement.Foreground="{TemplateBinding Foreground}" />
|
||
|
</CheckBox>
|
||
|
</Border>
|
||
|
<ControlTemplate.Triggers>
|
||
|
<Trigger Property="IsMouseOver" Value="True">
|
||
|
<Setter Property="Background" Value="{DynamicResource DefaultBackgroundSolidColorBrush}" />
|
||
|
</Trigger>
|
||
|
</ControlTemplate.Triggers>
|
||
|
</ControlTemplate>
|
||
|
</Setter.Value>
|
||
|
</Setter>
|
||
|
</Style>
|
||
|
<Style TargetType="{x:Type local:MultiSelectComboBox}">
|
||
|
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto" />
|
||
|
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto" />
|
||
|
<Setter Property="ScrollViewer.CanContentScroll" Value="True" />
|
||
|
<Setter Property="SelectionMode" Value="Multiple" />
|
||
|
<Setter Property="MinWidth" Value="120" />
|
||
|
<Setter Property="Height" Value="25" />
|
||
|
<Setter Property="ItemContainerStyle" Value="{StaticResource DefaultMultiSelectComboBoxItem}" />
|
||
|
<Setter Property="HorizontalContentAlignment" Value="Left" />
|
||
|
<Setter Property="VerticalContentAlignment" Value="Center" />
|
||
|
<Setter Property="BorderBrush" Value="{DynamicResource BaseSolidColorBrush}" />
|
||
|
<Setter Property="BorderThickness" Value="1" />
|
||
|
<Setter Property="Background" Value="{DynamicResource BackgroundSolidColorBrush}" />
|
||
|
<Setter Property="Padding" Value="14.5,3,30,3" />
|
||
|
<Setter Property="Template">
|
||
|
<Setter.Value>
|
||
|
<ControlTemplate TargetType="{x:Type local:MultiSelectComboBox}">
|
||
|
<ControlTemplate.Resources>
|
||
|
<Storyboard x:Key="OpenStoryboard">
|
||
|
<DoubleAnimation
|
||
|
EasingFunction="{StaticResource ExponentialEaseOut}"
|
||
|
Storyboard.TargetName="PART_DropDown"
|
||
|
Storyboard.TargetProperty="(Grid.RenderTransform).(ScaleTransform.ScaleY)"
|
||
|
To="1"
|
||
|
Duration="00:00:.2" />
|
||
|
</Storyboard>
|
||
|
<Storyboard x:Key="CloseStoryboard">
|
||
|
<DoubleAnimation
|
||
|
EasingFunction="{StaticResource ExponentialEaseOut}"
|
||
|
Storyboard.TargetName="PART_DropDown"
|
||
|
Storyboard.TargetProperty="(Grid.RenderTransform).(ScaleTransform.ScaleY)"
|
||
|
To="0"
|
||
|
Duration="00:00:.2" />
|
||
|
</Storyboard>
|
||
|
</ControlTemplate.Resources>
|
||
|
<local:SmallPanel SnapsToDevicePixels="True">
|
||
|
<Border
|
||
|
Name="PART_Border"
|
||
|
Background="Transparent"
|
||
|
BorderBrush="{TemplateBinding BorderBrush}"
|
||
|
BorderThickness="{TemplateBinding BorderThickness}"
|
||
|
CornerRadius="{Binding Path=(local:ElementHelper.CornerRadius), RelativeSource={RelativeSource TemplatedParent}}"
|
||
|
SnapsToDevicePixels="True" />
|
||
|
|
||
|
|
||
|
<ToggleButton
|
||
|
x:Name="PART_ToggleButton"
|
||
|
ClickMode="Release"
|
||
|
Focusable="False"
|
||
|
IsChecked="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
|
||
|
Style="{x:Null}"
|
||
|
Template="{StaticResource ComboBoxToggleButton1}" />
|
||
|
<TextBox
|
||
|
Name="PART_EditableTextBox"
|
||
|
Width="auto"
|
||
|
Margin="0,0,30,0"
|
||
|
Padding="0"
|
||
|
HorizontalAlignment="Left"
|
||
|
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||
|
HorizontalContentAlignment="Left"
|
||
|
Background="Transparent"
|
||
|
Focusable="True"
|
||
|
Foreground="#6495ED"
|
||
|
IsReadOnly="True"
|
||
|
SelectionBrush="{DynamicResource WindowBorderBrushSolidColorBrush}"
|
||
|
Style="{x:Null}"
|
||
|
Template="{StaticResource ComboBoxTextBox}"
|
||
|
Text="{Binding Text, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}" />
|
||
|
|
||
|
<Popup
|
||
|
x:Name="PART_Popup"
|
||
|
AllowsTransparency="True"
|
||
|
IsOpen="{Binding IsDropDownOpen, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}"
|
||
|
Placement="Bottom"
|
||
|
PlacementTarget="{Binding ElementName=PART_ToggleButton}"
|
||
|
StaysOpen="False">
|
||
|
<local:SmallPanel
|
||
|
x:Name="PART_DropDown"
|
||
|
MinWidth="{TemplateBinding FrameworkElement.ActualWidth}"
|
||
|
MaxHeight="{TemplateBinding MaxDropDownHeight}"
|
||
|
Margin="24,2,24,24"
|
||
|
RenderTransformOrigin=".5,0"
|
||
|
SnapsToDevicePixels="True">
|
||
|
<local:SmallPanel.RenderTransform>
|
||
|
<ScaleTransform ScaleY="0" />
|
||
|
</local:SmallPanel.RenderTransform>
|
||
|
<Border
|
||
|
Name="PART_DropDownBorder"
|
||
|
Background="#6495ED"
|
||
|
BorderBrush="{TemplateBinding BorderBrush}"
|
||
|
BorderThickness="{TemplateBinding BorderThickness}"
|
||
|
CornerRadius="{Binding Path=(local:ElementHelper.CornerRadius), RelativeSource={RelativeSource TemplatedParent}}"
|
||
|
Effect="{StaticResource PopupShadowDepth}"
|
||
|
SnapsToDevicePixels="True"
|
||
|
UseLayoutRounding="True" />
|
||
|
<Grid Margin="0,8" ClipToBounds="False">
|
||
|
<Grid.RowDefinitions>
|
||
|
<RowDefinition Height="Auto" />
|
||
|
<RowDefinition />
|
||
|
</Grid.RowDefinitions>
|
||
|
<local:MultiSelectComboBoxItem
|
||
|
x:Name="PART_CheckBoxAll"
|
||
|
Content="{TemplateBinding SelectAllContent}"
|
||
|
Style="{TemplateBinding ItemContainerStyle}"
|
||
|
Visibility="{TemplateBinding IsSelectAllActive}" />
|
||
|
<ScrollViewer
|
||
|
x:Name="DropDownScrollViewer"
|
||
|
Grid.Row="1"
|
||
|
ScrollViewer.VerticalScrollBarVisibility="Auto">
|
||
|
<ItemsPresenter
|
||
|
x:Name="ItemsPresenter"
|
||
|
KeyboardNavigation.DirectionalNavigation="Contained"
|
||
|
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
|
||
|
</ScrollViewer>
|
||
|
</Grid>
|
||
|
</local:SmallPanel>
|
||
|
</Popup>
|
||
|
</local:SmallPanel>
|
||
|
<ControlTemplate.Triggers>
|
||
|
<Trigger SourceName="PART_ToggleButton" Property="IsChecked" Value="True">
|
||
|
<Trigger.EnterActions>
|
||
|
<BeginStoryboard x:Name="BeginStoryboardOpenStoryboard" Storyboard="{StaticResource OpenStoryboard}" />
|
||
|
</Trigger.EnterActions>
|
||
|
<Trigger.ExitActions>
|
||
|
<StopStoryboard BeginStoryboardName="BeginStoryboardOpenStoryboard" />
|
||
|
</Trigger.ExitActions>
|
||
|
</Trigger>
|
||
|
<Trigger SourceName="PART_ToggleButton" Property="IsChecked" Value="False">
|
||
|
<Trigger.EnterActions>
|
||
|
<BeginStoryboard x:Name="BeginStoryboardCloseStoryboard" Storyboard="{StaticResource CloseStoryboard}" />
|
||
|
</Trigger.EnterActions>
|
||
|
<Trigger.ExitActions>
|
||
|
<StopStoryboard BeginStoryboardName="BeginStoryboardCloseStoryboard" />
|
||
|
</Trigger.ExitActions>
|
||
|
</Trigger>
|
||
|
<Trigger Property="IsMouseOver" Value="True">
|
||
|
<Setter TargetName="PART_Border" Property="BorderBrush" Value="{DynamicResource PrimaryNormalSolidColorBrush}" />
|
||
|
</Trigger>
|
||
|
<Trigger SourceName="PART_Popup" Property="AllowsTransparency" Value="True">
|
||
|
<Setter TargetName="PART_DropDownBorder" Property="Margin" Value="0,2,0,0" />
|
||
|
</Trigger>
|
||
|
</ControlTemplate.Triggers>
|
||
|
</ControlTemplate>
|
||
|
</Setter.Value>
|
||
|
</Setter>
|
||
|
</Style>
|
||
|
<!-- 多选 Combox End -->
|
||
|
|
||
|
</ResourceDictionary>
|