163 lines
8.9 KiB
XML
163 lines
8.9 KiB
XML
<ResourceDictionary
|
||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||
xmlns:assists="clr-namespace:Melskin.Assists"
|
||
xmlns:controls="clr-namespace:Melskin.Controls"
|
||
xmlns:decorations="clr-namespace:Melskin.Controls.Decorations"
|
||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||
|
||
<ResourceDictionary.MergedDictionaries>
|
||
<ResourceDictionary Source="/Melskin;component/Themes/Animations.xaml" />
|
||
<ResourceDictionary Source="/Melskin;component/Controls/IconElement.xaml" />
|
||
</ResourceDictionary.MergedDictionaries>
|
||
|
||
<Style TargetType="{x:Type controls:Tag}" x:Key="TagBaseStyle">
|
||
<Setter Property="IsTabStop" Value="False" />
|
||
<Setter Property="SnapsToDevicePixels" Value="True" />
|
||
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
|
||
<Setter Property="HorizontalAlignment" Value="Center" />
|
||
<Setter Property="VerticalAlignment" Value="Center" />
|
||
<Setter Property="VerticalContentAlignment" Value="Center" />
|
||
<Setter Property="HorizontalContentAlignment" Value="Center" />
|
||
<Setter Property="FontSize" Value="12" />
|
||
<!--<Setter Property="FontFamily" Value="{DynamicResource FontFamily}" />-->
|
||
<Setter Property="Background" Value="{DynamicResource ControlBackgroundNormalBrush}" />
|
||
<Setter Property="Foreground" Value="{DynamicResource TextPrimaryBrush}" />
|
||
<!--<Setter Property="assists:ControlAssist.BorderStyle" Value="{DynamicResource BorderStyleBase}" />-->
|
||
<Setter Property="assists:ControlAssist.CornerRadius" Value="4" />
|
||
<Setter Property="RenderTransformOrigin" Value="0,0.5" />
|
||
<Setter Property="RenderTransform">
|
||
<Setter.Value>
|
||
<ScaleTransform />
|
||
</Setter.Value>
|
||
</Setter>
|
||
</Style>
|
||
<Style
|
||
BasedOn="{StaticResource TagBaseStyle}"
|
||
TargetType="{x:Type controls:Tag}"
|
||
x:Key="EmbossTag">
|
||
<Setter Property="Padding" Value="8,2" />
|
||
<Setter Property="Template">
|
||
<Setter.Value>
|
||
<ControlTemplate TargetType="{x:Type controls:Tag}">
|
||
<decorations:EmbossBorder
|
||
CornerRadius="{TemplateBinding assists:ControlAssist.CornerRadius}"
|
||
Focusable="False"
|
||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||
Margin="-4"
|
||
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
|
||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||
x:Name="Effect">
|
||
<Border
|
||
Background="{TemplateBinding Background}"
|
||
CornerRadius="{TemplateBinding assists:ControlAssist.CornerRadius}"
|
||
Padding="{TemplateBinding Padding}"
|
||
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
|
||
UseLayoutRounding="True"
|
||
x:Name="Border">
|
||
<!-- Content -->
|
||
<Grid>
|
||
<Grid.ColumnDefinitions>
|
||
<!-- Content -->
|
||
<ColumnDefinition Width="*" />
|
||
<!-- Close Button -->
|
||
<ColumnDefinition Width="Auto" />
|
||
</Grid.ColumnDefinitions>
|
||
<ContentPresenter
|
||
Content="{TemplateBinding Content}"
|
||
ContentStringFormat="{TemplateBinding ContentStringFormat}"
|
||
ContentTemplate="{TemplateBinding ContentTemplate}"
|
||
ContentTemplateSelector="{TemplateBinding ContentTemplateSelector}"
|
||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
|
||
<!-- 关闭图标 为了让触发Close范围足够大而不是只有Path的才能触发,套了一层Border -->
|
||
<Border
|
||
Background="Transparent"
|
||
Grid.Column="1"
|
||
VerticalAlignment="Center"
|
||
Visibility="Collapsed"
|
||
x:Name="PART_Close">
|
||
<controls:IconElement
|
||
Foreground="{TemplateBinding Foreground}"
|
||
Style="{StaticResource ToolIcon}"
|
||
Symbol="Close"
|
||
UseLayoutRounding="True" />
|
||
</Border>
|
||
</Grid>
|
||
</Border>
|
||
</decorations:EmbossBorder>
|
||
<ControlTemplate.Triggers>
|
||
<Trigger Property="Closable" Value="True">
|
||
<Setter Property="Visibility" TargetName="PART_Close" Value="Visible" />
|
||
</Trigger>
|
||
</ControlTemplate.Triggers>
|
||
</ControlTemplate>
|
||
</Setter.Value>
|
||
</Setter>
|
||
<Style.Triggers>
|
||
<Trigger Property="IsMouseOver" Value="True">
|
||
<Setter Property="Opacity" Value="0.85" />
|
||
</Trigger>
|
||
</Style.Triggers>
|
||
</Style>
|
||
|
||
<Style BasedOn="{StaticResource TagBaseStyle}" TargetType="{x:Type controls:Tag}">
|
||
<Setter Property="Padding" Value="6,4" />
|
||
<Setter Property="BorderThickness" Value="1" />
|
||
<Setter Property="BorderBrush" Value="{DynamicResource BorderNormalBrush}" />
|
||
<Setter Property="Template">
|
||
<Setter.Value>
|
||
<ControlTemplate TargetType="{x:Type controls:Tag}">
|
||
<Border
|
||
Background="{TemplateBinding Background}"
|
||
BorderBrush="{TemplateBinding BorderBrush}"
|
||
BorderThickness="{TemplateBinding BorderThickness}"
|
||
CornerRadius="{TemplateBinding assists:ControlAssist.CornerRadius}"
|
||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||
Padding="{TemplateBinding Padding}"
|
||
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
|
||
UseLayoutRounding="True"
|
||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||
x:Name="Border">
|
||
<!-- Content -->
|
||
<Grid>
|
||
<Grid.ColumnDefinitions>
|
||
<!-- Content -->
|
||
<ColumnDefinition Width="*" />
|
||
<!-- Close Button -->
|
||
<ColumnDefinition Width="Auto" />
|
||
</Grid.ColumnDefinitions>
|
||
<ContentPresenter
|
||
Content="{TemplateBinding Content}"
|
||
ContentStringFormat="{TemplateBinding ContentStringFormat}"
|
||
ContentTemplate="{TemplateBinding ContentTemplate}"
|
||
ContentTemplateSelector="{TemplateBinding ContentTemplateSelector}"
|
||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
|
||
<controls:IconElement
|
||
Background="Transparent"
|
||
Foreground="{TemplateBinding Foreground}"
|
||
Grid.Column="1"
|
||
Padding="1,-4,-4,-4"
|
||
Style="{StaticResource ToolIcon}"
|
||
Symbol="Close"
|
||
UseLayoutRounding="True"
|
||
Visibility="Collapsed"
|
||
x:Name="PART_Close" />
|
||
</Grid>
|
||
</Border>
|
||
<ControlTemplate.Triggers>
|
||
<Trigger Property="Closable" Value="True">
|
||
<Setter Property="Visibility" TargetName="PART_Close" Value="Visible" />
|
||
</Trigger>
|
||
</ControlTemplate.Triggers>
|
||
</ControlTemplate>
|
||
</Setter.Value>
|
||
</Setter>
|
||
<Style.Triggers>
|
||
<Trigger Property="IsMouseOver" Value="True">
|
||
<Setter Property="Opacity" Value="0.85" />
|
||
</Trigger>
|
||
</Style.Triggers>
|
||
</Style>
|
||
|
||
</ResourceDictionary> |