288 lines
17 KiB
Plaintext
288 lines
17 KiB
Plaintext
|
|
<ResourceDictionary
|
||
|
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||
|
|
xmlns:controls="clr-namespace:AntDesign.WPF.Controls"
|
||
|
|
xmlns:helpers="clr-namespace:AntDesign.WPF.Helpers"
|
||
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||
|
|
|
||
|
|
<ResourceDictionary.MergedDictionaries>
|
||
|
|
<ResourceDictionary Source="pack://application:,,,/AntDesign.WPF;component/Styles/Converters.xaml" />
|
||
|
|
<ResourceDictionary Source="pack://application:,,,/AntDesign.WPF;component/Styles/Animations.xaml" />
|
||
|
|
<ResourceDictionary Source="pack://application:,,,/AntDesign.WPF;component/Styles/Control.xaml" />
|
||
|
|
<ResourceDictionary Source="pack://application:,,,/AntDesign.WPF;component/Styles/Input.xaml" />
|
||
|
|
</ResourceDictionary.MergedDictionaries>
|
||
|
|
|
||
|
|
<Style TargetType="{x:Type ToggleButton}" x:Key="Ant.ComboBoxToggleButton">
|
||
|
|
<Setter Property="OverridesDefaultStyle" Value="True" />
|
||
|
|
<Setter Property="Template">
|
||
|
|
<Setter.Value>
|
||
|
|
<ControlTemplate TargetType="{x:Type ToggleButton}">
|
||
|
|
<Grid
|
||
|
|
Background="{TemplateBinding Background}"
|
||
|
|
Opacity="0.45"
|
||
|
|
x:Name="Root">
|
||
|
|
<ContentPresenter
|
||
|
|
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||
|
|
Margin="{TemplateBinding Padding}"
|
||
|
|
RenderTransformOrigin="0.5,0.5"
|
||
|
|
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||
|
|
x:Name="Content">
|
||
|
|
<ContentPresenter.RenderTransform>
|
||
|
|
<RotateTransform />
|
||
|
|
</ContentPresenter.RenderTransform>
|
||
|
|
</ContentPresenter>
|
||
|
|
<VisualStateManager.VisualStateGroups>
|
||
|
|
<VisualStateGroup x:Name="CommonStates">
|
||
|
|
<VisualStateGroup.Transitions>
|
||
|
|
<VisualTransition GeneratedDuration="0:0:0.3" />
|
||
|
|
</VisualStateGroup.Transitions>
|
||
|
|
<VisualState x:Name="Normal" />
|
||
|
|
<VisualState x:Name="MouseOver">
|
||
|
|
<Storyboard>
|
||
|
|
<DoubleAnimation
|
||
|
|
Storyboard.TargetName="Root"
|
||
|
|
Storyboard.TargetProperty="Opacity"
|
||
|
|
To="0.65" />
|
||
|
|
</Storyboard>
|
||
|
|
</VisualState>
|
||
|
|
<VisualState x:Name="Pressed">
|
||
|
|
<Storyboard>
|
||
|
|
<DoubleAnimation
|
||
|
|
Storyboard.TargetName="Root"
|
||
|
|
Storyboard.TargetProperty="Opacity"
|
||
|
|
To="1" />
|
||
|
|
</Storyboard>
|
||
|
|
</VisualState>
|
||
|
|
<VisualState x:Name="Disabled" />
|
||
|
|
</VisualStateGroup>
|
||
|
|
<VisualStateGroup x:Name="CheckStates">
|
||
|
|
<VisualStateGroup.Transitions>
|
||
|
|
<VisualTransition GeneratedDuration="0:0:0.3" />
|
||
|
|
</VisualStateGroup.Transitions>
|
||
|
|
<VisualState x:Name="Checked">
|
||
|
|
<Storyboard>
|
||
|
|
<DoubleAnimation
|
||
|
|
Storyboard.TargetName="Content"
|
||
|
|
Storyboard.TargetProperty="RenderTransform.Angle"
|
||
|
|
To="180" />
|
||
|
|
</Storyboard>
|
||
|
|
</VisualState>
|
||
|
|
<VisualState x:Name="Unchecked" />
|
||
|
|
</VisualStateGroup>
|
||
|
|
</VisualStateManager.VisualStateGroups>
|
||
|
|
</Grid>
|
||
|
|
</ControlTemplate>
|
||
|
|
</Setter.Value>
|
||
|
|
</Setter>
|
||
|
|
</Style>
|
||
|
|
|
||
|
|
<Style
|
||
|
|
BasedOn="{StaticResource Ant.Input}"
|
||
|
|
TargetType="{x:Type ComboBox}"
|
||
|
|
x:Key="Ant.ComboBox">
|
||
|
|
<Setter Property="MaxDropDownHeight" Value="250" />
|
||
|
|
<Setter Property="Template">
|
||
|
|
<Setter.Value>
|
||
|
|
<ControlTemplate TargetType="{x:Type ComboBox}">
|
||
|
|
<Grid>
|
||
|
|
<!-- Input Effect -->
|
||
|
|
<Border
|
||
|
|
BorderBrush="{TemplateBinding BorderBrush}"
|
||
|
|
BorderThickness="{DynamicResource OutlineThickness}"
|
||
|
|
CornerRadius="{TemplateBinding helpers:AntdControl.CornerRadius}"
|
||
|
|
Focusable="False"
|
||
|
|
Margin="{Binding BorderThickness, Mode=OneWay, RelativeSource={RelativeSource Self}, Converter={StaticResource ThicknessReverseConverter}}"
|
||
|
|
Opacity="0"
|
||
|
|
x:Name="Effect" />
|
||
|
|
<!-- Input -->
|
||
|
|
<controls:AntdBorder
|
||
|
|
Background="{TemplateBinding Background}"
|
||
|
|
BorderBrush="{TemplateBinding BorderBrush}"
|
||
|
|
BorderStyle="{TemplateBinding helpers:AntdControl.BorderStyle}"
|
||
|
|
BorderThickness="{TemplateBinding BorderThickness}"
|
||
|
|
CornerRadius="{TemplateBinding helpers:AntdControl.CornerRadius}"
|
||
|
|
Padding="{TemplateBinding Padding}"
|
||
|
|
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
|
||
|
|
UseLayoutRounding="True"
|
||
|
|
x:Name="Border">
|
||
|
|
<Grid>
|
||
|
|
<Grid.ColumnDefinitions>
|
||
|
|
<!-- Prefix -->
|
||
|
|
<ColumnDefinition Width="Auto" />
|
||
|
|
<!-- Input -->
|
||
|
|
<ColumnDefinition Width="*" />
|
||
|
|
<!-- Suffix -->
|
||
|
|
<ColumnDefinition Width="Auto" />
|
||
|
|
</Grid.ColumnDefinitions>
|
||
|
|
<!-- Prefix -->
|
||
|
|
<ContentPresenter
|
||
|
|
Content="{TemplateBinding helpers:Input.Prefix}"
|
||
|
|
Focusable="False"
|
||
|
|
Grid.Column="0"
|
||
|
|
Margin="1,0,5,0"
|
||
|
|
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||
|
|
x:Name="Prefix" />
|
||
|
|
<!-- Placeholder -->
|
||
|
|
<TextBlock
|
||
|
|
Focusable="False"
|
||
|
|
Foreground="{TemplateBinding helpers:Input.PlaceholderBrush}"
|
||
|
|
Grid.Column="1"
|
||
|
|
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||
|
|
Text="{TemplateBinding helpers:Input.Placeholder}"
|
||
|
|
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||
|
|
Visibility="Collapsed"
|
||
|
|
x:Name="Placeholder" />
|
||
|
|
<!-- Editable TextBox -->
|
||
|
|
<TextBox
|
||
|
|
Grid.Column="1"
|
||
|
|
Style="{StaticResource Ant.EditableTextBox}"
|
||
|
|
Visibility="Collapsed"
|
||
|
|
x:Name="PART_EditableTextBox" />
|
||
|
|
<!-- ContentSite -->
|
||
|
|
<ContentPresenter
|
||
|
|
Content="{TemplateBinding SelectionBoxItem}"
|
||
|
|
ContentStringFormat="{TemplateBinding SelectionBoxItemStringFormat}"
|
||
|
|
ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}"
|
||
|
|
ContentTemplateSelector="{TemplateBinding ItemTemplateSelector}"
|
||
|
|
Grid.Column="1"
|
||
|
|
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||
|
|
IsHitTestVisible="False"
|
||
|
|
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
|
||
|
|
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||
|
|
x:Name="ContentSite" />
|
||
|
|
<!-- DropDownToggle -->
|
||
|
|
<ToggleButton
|
||
|
|
Background="Transparent"
|
||
|
|
Focusable="False"
|
||
|
|
Grid.Column="1"
|
||
|
|
Grid.ColumnSpan="2"
|
||
|
|
HorizontalContentAlignment="Right"
|
||
|
|
IsChecked="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
|
||
|
|
IsTabStop="False"
|
||
|
|
Padding="5,0,1,0"
|
||
|
|
Style="{StaticResource Ant.ComboBoxToggleButton}"
|
||
|
|
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||
|
|
x:Name="DropDownToggle">
|
||
|
|
<controls:Icon Type="down" />
|
||
|
|
</ToggleButton>
|
||
|
|
<!-- Clear -->
|
||
|
|
<controls:Icon
|
||
|
|
Focusable="False"
|
||
|
|
Grid.Column="2"
|
||
|
|
Margin="5,0,1,0"
|
||
|
|
Style="{StaticResource Ant.Clearable}"
|
||
|
|
Type="close"
|
||
|
|
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||
|
|
Visibility="Collapsed"
|
||
|
|
helpers:Input.ClearEnabled="True"
|
||
|
|
x:Name="Clear" />
|
||
|
|
</Grid>
|
||
|
|
</controls:AntdBorder>
|
||
|
|
<!-- Popup -->
|
||
|
|
<Popup
|
||
|
|
AllowsTransparency="True"
|
||
|
|
Focusable="False"
|
||
|
|
IsOpen="{TemplateBinding IsDropDownOpen}"
|
||
|
|
Placement="Bottom"
|
||
|
|
PopupAnimation="Slide"
|
||
|
|
VerticalOffset="4"
|
||
|
|
x:Name="PART_Popup">
|
||
|
|
<Border
|
||
|
|
Background="{TemplateBinding Background}"
|
||
|
|
CornerRadius="{TemplateBinding helpers:AntdControl.CornerRadius}"
|
||
|
|
Margin="8"
|
||
|
|
MaxHeight="{TemplateBinding MaxDropDownHeight}"
|
||
|
|
Width="{Binding ActualWidth, Mode=OneWay, ElementName=Border}">
|
||
|
|
<Border.Effect>
|
||
|
|
<DropShadowEffect
|
||
|
|
BlurRadius="8"
|
||
|
|
Opacity="0.15"
|
||
|
|
ShadowDepth="0" />
|
||
|
|
</Border.Effect>
|
||
|
|
<ScrollViewer>
|
||
|
|
<ItemsPresenter KeyboardNavigation.DirectionalNavigation="Contained" />
|
||
|
|
</ScrollViewer>
|
||
|
|
</Border>
|
||
|
|
</Popup>
|
||
|
|
<VisualStateManager.VisualStateGroups>
|
||
|
|
<VisualStateGroup x:Name="FocusStates">
|
||
|
|
<VisualStateGroup.Transitions>
|
||
|
|
<VisualTransition GeneratedDuration="0:0:0.3" />
|
||
|
|
</VisualStateGroup.Transitions>
|
||
|
|
<VisualState Storyboard="{StaticResource Ant.InputAnimating}" x:Name="Focused" />
|
||
|
|
<VisualState x:Name="Unfocused" />
|
||
|
|
</VisualStateGroup>
|
||
|
|
</VisualStateManager.VisualStateGroups>
|
||
|
|
</Grid>
|
||
|
|
<ControlTemplate.Triggers>
|
||
|
|
<Trigger Property="Content" SourceName="Prefix" Value="{x:Null}">
|
||
|
|
<Setter Property="Visibility" TargetName="Prefix" Value="Collapsed" />
|
||
|
|
</Trigger>
|
||
|
|
<Trigger Property="IsEditable" Value="True">
|
||
|
|
<Setter Property="Visibility" TargetName="ContentSite" Value="Hidden" />
|
||
|
|
<Setter Property="Background" TargetName="DropDownToggle" Value="{x:Null}" />
|
||
|
|
<Setter Property="Visibility" TargetName="PART_EditableTextBox" Value="Visible" />
|
||
|
|
</Trigger>
|
||
|
|
<!-- Fix Focused -->
|
||
|
|
<Trigger Property="IsFocused" SourceName="PART_EditableTextBox" Value="True">
|
||
|
|
<Setter Property="BorderBrush" Value="{DynamicResource OutlineBrush}" />
|
||
|
|
</Trigger>
|
||
|
|
<MultiDataTrigger>
|
||
|
|
<MultiDataTrigger.Conditions>
|
||
|
|
<Condition Binding="{Binding Text, Mode=OneWay, ElementName=PART_EditableTextBox}" Value="" />
|
||
|
|
<Condition Binding="{Binding SelectedItem, Mode=OneWay, RelativeSource={RelativeSource Self}}" Value="{x:Null}" />
|
||
|
|
</MultiDataTrigger.Conditions>
|
||
|
|
<Setter Property="Visibility" TargetName="Placeholder" Value="Visible" />
|
||
|
|
</MultiDataTrigger>
|
||
|
|
<MultiTrigger>
|
||
|
|
<MultiTrigger.Conditions>
|
||
|
|
<Condition Property="helpers:Input.Clearable" Value="True" />
|
||
|
|
<Condition Property="Visibility" SourceName="Placeholder" Value="Collapsed" />
|
||
|
|
</MultiTrigger.Conditions>
|
||
|
|
<Setter Property="Visibility" TargetName="Clear" Value="Visible" />
|
||
|
|
<Setter Property="Content" TargetName="DropDownToggle" Value="" />
|
||
|
|
</MultiTrigger>
|
||
|
|
</ControlTemplate.Triggers>
|
||
|
|
</ControlTemplate>
|
||
|
|
</Setter.Value>
|
||
|
|
</Setter>
|
||
|
|
</Style>
|
||
|
|
|
||
|
|
<Style
|
||
|
|
BasedOn="{StaticResource Ant.TextElement}"
|
||
|
|
TargetType="{x:Type ComboBoxItem}"
|
||
|
|
x:Key="Ant.ComboBoxItem">
|
||
|
|
<Setter Property="BorderThickness" Value="0" />
|
||
|
|
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
|
||
|
|
<Setter Property="SnapsToDevicePixels" Value="True" />
|
||
|
|
<Setter Property="VerticalContentAlignment" Value="Center" />
|
||
|
|
<Setter Property="Padding" Value="{DynamicResource ItemPadding}" />
|
||
|
|
<Setter Property="Foreground" Value="{DynamicResource TextBrush}" />
|
||
|
|
<Setter Property="Template">
|
||
|
|
<Setter.Value>
|
||
|
|
<ControlTemplate TargetType="{x:Type ComboBoxItem}">
|
||
|
|
<Border
|
||
|
|
Background="{TemplateBinding Background}"
|
||
|
|
BorderBrush="{TemplateBinding BorderBrush}"
|
||
|
|
BorderThickness="{TemplateBinding BorderThickness}"
|
||
|
|
Padding="{TemplateBinding Padding}"
|
||
|
|
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
|
||
|
|
<ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
|
||
|
|
</Border>
|
||
|
|
</ControlTemplate>
|
||
|
|
</Setter.Value>
|
||
|
|
</Setter>
|
||
|
|
<Style.Triggers>
|
||
|
|
<Trigger Property="IsMouseOver" Value="True">
|
||
|
|
<Setter Property="Background" Value="{DynamicResource ItemMouseOverBackground}" />
|
||
|
|
</Trigger>
|
||
|
|
<Trigger Property="IsSelected" Value="True">
|
||
|
|
<Setter Property="FontWeight" Value="SemiBold" />
|
||
|
|
<Setter Property="Background" Value="{DynamicResource BackgroundBrushLight}" />
|
||
|
|
</Trigger>
|
||
|
|
<Trigger Property="IsEnabled" Value="False">
|
||
|
|
<Setter Property="Foreground" Value="{DynamicResource DisabledBrush}" />
|
||
|
|
</Trigger>
|
||
|
|
</Style.Triggers>
|
||
|
|
</Style>
|
||
|
|
|
||
|
|
</ResourceDictionary>
|