LabelBaseStyle.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="LabelBaseStyle" TargetType="Label">
  5. <Setter Property="Foreground" Value="{DynamicResource TextIconBrush}"/>
  6. <Setter Property="Background" Value="{DynamicResource RegionBrush}"/>
  7. <Setter Property="BorderBrush" Value="{DynamicResource BorderBrush}"/>
  8. <Setter Property="hc:BorderElement.CornerRadius" Value="{StaticResource DefaultCornerRadius}"/>
  9. <Setter Property="Padding" Value="{StaticResource DefaultControlPadding}"/>
  10. <Setter Property="HorizontalContentAlignment" Value="Center"/>
  11. <Setter Property="VerticalContentAlignment" Value="Center"/>
  12. <Setter Property="HorizontalAlignment" Value="Center"/>
  13. <Setter Property="VerticalAlignment" Value="Center"/>
  14. <Setter Property="Height" Value="{StaticResource DefaultControlHeight}" />
  15. <Setter Property="Template">
  16. <Setter.Value>
  17. <ControlTemplate TargetType="Label">
  18. <Border CornerRadius="{Binding Path=(hc:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}" SnapsToDevicePixels="true">
  19. <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
  20. </Border>
  21. </ControlTemplate>
  22. </Setter.Value>
  23. </Setter>
  24. <Style.Triggers>
  25. <Trigger Property="IsEnabled" Value="False">
  26. <Setter Property="Opacity" Value="0.4"/>
  27. </Trigger>
  28. </Style.Triggers>
  29. </Style>
  30. </ResourceDictionary>