更新
This commit is contained in:
161
AntdWpf/Styles/Tag.xaml
Normal file
161
AntdWpf/Styles/Tag.xaml
Normal file
@@ -0,0 +1,161 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:controls="clr-namespace:AntdWpf.Controls"
|
||||
xmlns:Behaviors="clr-namespace:AntdWpf.Behaviors"
|
||||
xmlns:helpers="clr-namespace:AntdWpf.Helpers">
|
||||
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="pack://application:,,,/AntdWpf;component/Styles/Converters.xaml" />
|
||||
<ResourceDictionary Source="pack://application:,,,/AntdWpf;component/Styles/Animations.xaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
|
||||
<Style TargetType="{x:Type controls:Tag}">
|
||||
<Setter Property="Padding" Value="8 4" />
|
||||
<Setter Property="Margin" Value="0 0 8 0" />
|
||||
<Setter Property="IsTabStop" Value="False" />
|
||||
<Setter Property="SnapsToDevicePixels" Value="True" />
|
||||
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
|
||||
<Setter Property="VerticalContentAlignment" Value="Center" />
|
||||
<Setter Property="FontSize" Value="{DynamicResource TagFontSize}" />
|
||||
<Setter Property="FontFamily" Value="{DynamicResource FontFamily}" />
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource BorderBrushBase}" />
|
||||
<Setter Property="Background" Value="{DynamicResource TagDefaultBackground}" />
|
||||
<Setter Property="Foreground" Value="{DynamicResource TagDefaultForeground}" />
|
||||
<Setter Property="BorderThickness" Value="{DynamicResource BorderThicknessBase}" />
|
||||
<Setter Property="helpers:Control.BorderStyle" Value="{DynamicResource BorderStyleBase}" />
|
||||
<Setter Property="helpers:Control.CornerRadius" Value="{DynamicResource BorderRadiusBase}" />
|
||||
<Setter Property="RenderTransformOrigin" Value="0,0.5" />
|
||||
<Setter Property="RenderTransform">
|
||||
<Setter.Value>
|
||||
<ScaleTransform />
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Setter Property="Behaviors:StylizedBehaviors.Behaviors">
|
||||
<Setter.Value>
|
||||
<Behaviors:StylizedBehaviorCollection>
|
||||
<Behaviors:VisibilityBehavior>
|
||||
<Behaviors:VisibilityBehavior.Appear>
|
||||
<Storyboard>
|
||||
<DoubleAnimation Storyboard.TargetProperty="Opacity"
|
||||
EasingFunction="{StaticResource EaseInOutCirc}"
|
||||
Duration="0:0:0.2"
|
||||
From="0"
|
||||
To="1" />
|
||||
</Storyboard>
|
||||
</Behaviors:VisibilityBehavior.Appear>
|
||||
<Behaviors:VisibilityBehavior.Leave>
|
||||
<Storyboard FillBehavior="Stop">
|
||||
<DoubleAnimation Storyboard.TargetProperty="Opacity"
|
||||
EasingFunction="{StaticResource EaseInOutCirc}"
|
||||
Duration="0:0:0.3"
|
||||
To="0" />
|
||||
<DoubleAnimation Storyboard.TargetProperty="RenderTransform.ScaleX"
|
||||
EasingFunction="{StaticResource EaseInOutCirc}"
|
||||
Duration="0:0:0.3"
|
||||
To="0.2" />
|
||||
<DoubleAnimation Storyboard.TargetProperty="RenderTransform.ScaleY"
|
||||
EasingFunction="{StaticResource EaseInOutCirc}"
|
||||
Duration="0:0:0.3"
|
||||
To="0.2" />
|
||||
</Storyboard>
|
||||
</Behaviors:VisibilityBehavior.Leave>
|
||||
</Behaviors:VisibilityBehavior>
|
||||
</Behaviors:StylizedBehaviorCollection>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type controls:Tag}">
|
||||
<Grid>
|
||||
<!-- Effect -->
|
||||
<Border x:Name="Effect"
|
||||
Margin="-1"
|
||||
Opacity="0.35"
|
||||
Focusable="False"
|
||||
BorderThickness="0"
|
||||
BorderBrush="{DynamicResource PrimaryBrush}"
|
||||
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
|
||||
CornerRadius="{TemplateBinding helpers:Control.CornerRadius}" />
|
||||
<!-- Border -->
|
||||
<controls:Border x:Name="Border"
|
||||
UseLayoutRounding="True"
|
||||
Padding="{TemplateBinding Padding}"
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
|
||||
BorderStyle="{TemplateBinding helpers:Control.BorderStyle}"
|
||||
CornerRadius="{TemplateBinding helpers:Control.CornerRadius}">
|
||||
<!-- Content -->
|
||||
<Grid>
|
||||
<Grid.Resources>
|
||||
<Style x:Key="Ant.IconClose" TargetType="{x:Type controls:Icon}">
|
||||
<Setter Property="Opacity" Value="0.65" />
|
||||
<Setter Property="Margin" Value="3 0 0 0" />
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="Opacity" Value="1" />
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</Grid.Resources>
|
||||
<Grid.ColumnDefinitions>
|
||||
<!-- Content -->
|
||||
<ColumnDefinition Width="*" />
|
||||
<!-- Close Button -->
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<ContentPresenter Content="{TemplateBinding Content}"
|
||||
ContentTemplate="{TemplateBinding ContentTemplate}"
|
||||
ContentStringFormat="{TemplateBinding ContentStringFormat}"
|
||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
ContentTemplateSelector="{TemplateBinding ContentTemplateSelector}" />
|
||||
<controls:Icon x:Name="PART_Close"
|
||||
Grid.Column="1"
|
||||
Type="close"
|
||||
Focusable="False"
|
||||
Style="{StaticResource Ant.IconClose}"
|
||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" />
|
||||
</Grid>
|
||||
</controls:Border>
|
||||
</Grid>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="ColorMode" Value="Colorful">
|
||||
<Setter TargetName="Effect"
|
||||
Property="BorderBrush"
|
||||
Value="{Binding Foreground, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" />
|
||||
<Setter TargetName="Border"
|
||||
Property="Background"
|
||||
Value="{Binding Foreground, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent},
|
||||
Converter={StaticResource ColorPaletteConverter}, ConverterParameter=1}" />
|
||||
<Setter TargetName="Border"
|
||||
Property="BorderBrush"
|
||||
Value="{Binding Foreground, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent},
|
||||
Converter={StaticResource ColorPaletteConverter}, ConverterParameter=3}" />
|
||||
</Trigger>
|
||||
<Trigger Property="ColorMode" Value="Inverse">
|
||||
<Setter Property="Foreground" Value="White" />
|
||||
<Setter TargetName="Effect"
|
||||
Property="BorderBrush"
|
||||
Value="{Binding Background, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" />
|
||||
<Setter TargetName="Border"
|
||||
Property="BorderBrush"
|
||||
Value="{Binding Background, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" />
|
||||
</Trigger>
|
||||
<EventTrigger RoutedEvent="MouseLeftButtonUp">
|
||||
<BeginStoryboard Storyboard="{StaticResource Ant.ClickAnimating}" />
|
||||
</EventTrigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="Opacity" Value="0.85" />
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
||||
</ResourceDictionary>
|
||||
Reference in New Issue
Block a user