Files
Shrlalgo.RvKits/Melskin/Controls/Label.xaml

71 lines
3.7 KiB
Plaintext
Raw Normal View History

2025-07-31 20:12:01 +08:00
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
2026-02-20 15:31:44 +08:00
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:assists="clr-namespace:Melskin.Assists">
2025-07-31 20:12:01 +08:00
<!-- 标签对象 -->
2026-02-20 15:31:44 +08:00
<Style x:Key="BasicLabelStyle" TargetType="{x:Type Label}">
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
2026-02-20 15:31:44 +08:00
x:Name="contentBorder"
Padding="{TemplateBinding Padding}"
2025-07-31 20:12:01 +08:00
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="4"
2026-02-20 15:31:44 +08:00
SnapsToDevicePixels="true">
2025-07-31 20:12:01 +08:00
<ContentPresenter
2026-02-20 15:31:44 +08:00
x:Name="contentPresenter"
2025-07-31 20:12:01 +08:00
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
2026-02-20 15:31:44 +08:00
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
2025-07-31 20:12:01 +08:00
RecognizesAccessKey="True"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
2026-02-20 15:31:44 +08:00
TextElement.Foreground="{TemplateBinding Foreground}" />
2025-07-11 09:20:23 +08:00
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsEnabled" Value="false">
2026-02-20 15:31:44 +08:00
<Setter TargetName="contentPresenter" Property="TextElement.Foreground" 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-10-10 11:19:58 +08:00
<Style BasedOn="{StaticResource BasicLabelStyle}" TargetType="{x:Type Label}" />
2025-07-11 09:20:23 +08:00
2025-07-31 20:12:01 +08:00
<Style
2026-02-20 15:31:44 +08:00
x:Key="LabelPrimary"
2025-10-10 11:19:58 +08:00
BasedOn="{StaticResource BasicLabelStyle}"
2026-02-20 15:31:44 +08:00
TargetType="{x:Type Label}">
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
2026-02-20 15:31:44 +08:00
x:Key="LabelDanger"
2025-10-10 11:19:58 +08:00
BasedOn="{StaticResource BasicLabelStyle}"
2026-02-20 15:31:44 +08:00
TargetType="{x:Type Label}">
<Setter Property="Foreground" Value="{DynamicResource ErrorBrush}" />
<Setter Property="assists:ShadingAssist.DisabledForeground" Value="{DynamicResource ErrorDisabledBrush}" />
2025-07-11 09:20:23 +08:00
</Style>
2025-07-31 20:12:01 +08:00
<Style
2026-02-20 15:31:44 +08:00
x:Key="LabelSuccess"
2025-10-10 11:19:58 +08:00
BasedOn="{StaticResource BasicLabelStyle}"
2026-02-20 15:31:44 +08:00
TargetType="{x:Type Label}">
<Setter Property="Foreground" Value="{DynamicResource SuccessBrush}" />
<Setter Property="assists:ShadingAssist.DisabledForeground" Value="{DynamicResource SuccessDisabledBrush}" />
2025-07-11 09:20:23 +08:00
</Style>
</ResourceDictionary>