Files
HandyControl/Net40/HandyControl_Net40/Themes/Styles/Base/ShieldBaseStyle.xaml
T
2019-01-21 11:12:38 +08:00

39 lines
2.3 KiB
XML

<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="clr-namespace:HandyControl.Controls">
<Style x:Key="ShieldBaseStyle" TargetType="controls:Shield">
<Setter Property="Height" Value="20"/>
<Setter Property="Foreground" Value="{DynamicResource TextIconBrush}"/>
<Setter Property="controls:BorderElement.CornerRadius" Value="3"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="BorderBrush" Value="{DynamicResource BorderBrush}"/>
<Setter Property="Color" Value="{DynamicResource PrimaryBrush}"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="controls:Shield">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Grid.OpacityMask>
<VisualBrush Stretch="None">
<VisualBrush.Visual>
<Border x:Name="clipMask" Background="White" Width="{TemplateBinding ActualWidth}" Height="{TemplateBinding ActualHeight}" CornerRadius="{Binding Path=(controls:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}"/>
</VisualBrush.Visual>
</VisualBrush>
</Grid.OpacityMask>
<Border Grid.Column="0" Background="#555">
<TextBlock Text="{TemplateBinding Subject}" VerticalAlignment="Center" Margin="4,0"/>
</Border>
<Border Grid.Column="1" Background="{TemplateBinding Color}">
<ContentPresenter ContentSource="Status" VerticalAlignment="Center" Margin="4,0" TextElement.Foreground="{TemplateBinding Foreground}"/>
</Border>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>