Files
ShrlAlgoToolkit/NeuWPF/NeoUI/Controls/LabelStyle.xaml

71 lines
3.6 KiB
Plaintext
Raw Normal View History

2025-07-31 20:12:01 +08:00
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
2025-08-20 12:10:35 +08:00
xmlns:assists="clr-namespace:NeoUI.Assists"
2025-07-31 20:12:01 +08:00
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<!-- 标签对象 -->
<Style TargetType="{x:Type Label}" x:Key="LabelBasic">
2025-08-12 23:08:54 +08:00
<Setter Property="Background" Value="{DynamicResource ControlBackgroundNormalBrush}" />
<Setter Property="Foreground" Value="{DynamicResource TextPrimaryBrush}" />
2025-07-11 09:20:23 +08:00
<Setter Property="BorderBrush" Value="Transparent" />
2025-08-12 23:08:54 +08:00
<Setter Property="assists:ShadingAssist.DisabledForeground" Value="{DynamicResource TextDisabledBrush}" />
2025-07-11 09:20:23 +08:00
<Setter Property="BorderThickness" Value="1" />
<Setter Property="Margin" Value="4" />
<Setter Property="FontSize" Value="14" />
<Setter Property="Padding" Value="20,8" />
<Setter Property="HorizontalContentAlignment" Value="Center" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Label}">
2025-07-31 20:12:01 +08:00
<Border
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="4"
Padding="{TemplateBinding Padding}"
SnapsToDevicePixels="true"
x:Name="contentBorder">
<ContentPresenter
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
RecognizesAccessKey="True"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
TextElement.Foreground="{TemplateBinding Foreground}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
x:Name="contentPresenter" />
2025-07-11 09:20:23 +08:00
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsEnabled" Value="false">
2025-08-12 23:08:54 +08:00
<Setter Property="TextElement.Foreground" TargetName="contentPresenter" Value="{Binding Path=(assists:ShadingAssist.DisabledForeground), RelativeSource={RelativeSource TemplatedParent}}" />
2025-07-11 09:20:23 +08:00
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
2025-07-31 20:12:01 +08:00
<Style BasedOn="{StaticResource LabelBasic}" TargetType="{x:Type Label}" />
2025-07-11 09:20:23 +08:00
2025-07-31 20:12:01 +08:00
<Style
BasedOn="{StaticResource LabelBasic}"
TargetType="{x:Type Label}"
x:Key="LabelPrimary">
2025-08-12 23:08:54 +08:00
<Setter Property="Foreground" Value="{DynamicResource PrimaryNormalBrush}" />
<Setter Property="assists:ShadingAssist.DisabledForeground" Value="{DynamicResource PrimaryDisabledBrush}" />
2025-07-11 09:20:23 +08:00
</Style>
2025-07-31 20:12:01 +08:00
<Style
BasedOn="{StaticResource LabelBasic}"
TargetType="{x:Type Label}"
x:Key="LabelDanger">
2025-08-12 23:08:54 +08:00
<Setter Property="Foreground" Value="{StaticResource ErrorBrush}" />
<Setter Property="assists:ShadingAssist.DisabledForeground" Value="{StaticResource ErrorDisabledBrush}" />
2025-07-11 09:20:23 +08:00
</Style>
2025-07-31 20:12:01 +08:00
<Style
BasedOn="{StaticResource LabelBasic}"
TargetType="{x:Type Label}"
x:Key="LabelSuccess">
2025-07-11 09:20:23 +08:00
<Setter Property="Foreground" Value="{StaticResource SuccessBrush}" />
2025-08-12 23:08:54 +08:00
<Setter Property="assists:ShadingAssist.DisabledForeground" Value="{StaticResource SuccessDisabledBrush}" />
2025-07-11 09:20:23 +08:00
</Style>
</ResourceDictionary>