ShieldBaseStyle.xaml 2.1 KB

1234567891011121314151617181920212223242526272829303132
  1. <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  2. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  3. xmlns:hc="clr-namespace:HandyControl.Controls">
  4. <Style x:Key="ShieldBaseStyle" BasedOn="{StaticResource BaseStyle}" TargetType="hc:Shield">
  5. <Setter Property="Height" Value="20"/>
  6. <Setter Property="Foreground" Value="{DynamicResource TextIconBrush}"/>
  7. <Setter Property="hc:BorderElement.CornerRadius" Value="3"/>
  8. <Setter Property="BorderThickness" Value="0"/>
  9. <Setter Property="BorderBrush" Value="{DynamicResource BorderBrush}"/>
  10. <Setter Property="Color" Value="{DynamicResource PrimaryBrush}"/>
  11. <Setter Property="Template">
  12. <Setter.Value>
  13. <ControlTemplate TargetType="hc:Shield">
  14. <Grid>
  15. <Grid.ColumnDefinitions>
  16. <ColumnDefinition Width="Auto"/>
  17. <ColumnDefinition Width="Auto"/>
  18. </Grid.ColumnDefinitions>
  19. <Border Grid.Column="0" Background="#555" CornerRadius="{Binding Path=(hc:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource CornerRadiusSplitConverter},ConverterParameter='1,0,0,1'}">
  20. <TextBlock Text="{TemplateBinding Subject}" VerticalAlignment="Center" Margin="4,0"/>
  21. </Border>
  22. <Border Grid.Column="1" Background="{TemplateBinding Color}" CornerRadius="{Binding Path=(hc:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource CornerRadiusSplitConverter},ConverterParameter='0,1,1,0'}">
  23. <ContentPresenter ContentSource="Status" VerticalAlignment="Center" Margin="4,0" TextElement.Foreground="{TemplateBinding Foreground}" ContentStringFormat="{TemplateBinding ContentStringFormat}"/>
  24. </Border>
  25. </Grid>
  26. </ControlTemplate>
  27. </Setter.Value>
  28. </Setter>
  29. </Style>
  30. </ResourceDictionary>