This commit is contained in:
ShrlAlgo
2025-07-11 09:20:23 +08:00
parent c7b104f44f
commit 4d35cadb56
840 changed files with 102347 additions and 11595 deletions

View File

@@ -31,7 +31,7 @@ public class InfoBadge : System.Windows.Controls.Control
nameof(Severity),
typeof(InfoBadgeSeverity),
typeof(InfoBadge),
new PropertyMetadata(InfoBadgeSeverity.Informational));
new PropertyMetadata(InfoBadgeSeverity.Attention));
/// <summary>
/// Identifies the <see cref="Value"/> dependency property.

View File

@@ -7,26 +7,24 @@
<Thickness x:Key="IconBadgeMargin">2</Thickness>
<Style x:Key="DotInfoBadgeStyle" TargetType="{x:Type controls:InfoBadge}">
<Setter Property="Background">
<Setter.Value>
<SolidColorBrush Color="{DynamicResource InfoBadgeInformationSeverityBackgroundBrush}" />
</Setter.Value>
</Setter>
<!--<Setter Property="Background" Value="{DynamicResource AccentFillColorDefaultBrush}" />-->
<Setter Property="Background" Value="{DynamicResource ControlFillColorDefaultBrush}"/>
<Setter Property="Focusable" Value="False" />
<Setter Property="KeyboardNavigation.IsTabStop" Value="False" />
<Setter Property="SnapsToDevicePixels" Value="True" />
<Setter Property="Foreground" Value="{DynamicResource ButtonForeground}" />
<Setter Property="OverridesDefaultStyle" Value="True" />
<Setter Property="FontWeight" Value="Normal" />
<Setter Property="Width" Value="6"/>
<Setter Property="Height" Value="6"/>
<Setter Property="Foreground" Value="{DynamicResource TextFillColorPrimaryBrush}" />
<Setter Property="KeyboardNavigation.IsTabStop" Value="False" />
<Setter Property="OverridesDefaultStyle" Value="True" />
<Setter Property="SnapsToDevicePixels" Value="True" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type controls:InfoBadge}">
<Grid x:Name="InfoBadgeRoot">
<Border
x:Name="ContentBorder"
Width="6"
Height="6"
Width="{TemplateBinding Width}"
Height="{TemplateBinding Height}"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Background="{TemplateBinding Background}"
@@ -36,19 +34,16 @@
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="Severity" Value="Attention">
<Setter TargetName="ContentBorder" Property="Background" Value="{DynamicResource InfoBadgeAttentionSeverityBackgroundBrush}" />
</Trigger>
<Trigger Property="Severity" Value="Informational">
<Setter TargetName="ContentBorder" Property="Background" Value="{DynamicResource InfoBadgeInformationalSeverityBackgroundBrush}" />
<Setter TargetName="ContentBorder" Property="Background" Value="{DynamicResource SystemFillColorAttentionBackgroundBrush}" />
</Trigger>
<Trigger Property="Severity" Value="Success">
<Setter TargetName="ContentBorder" Property="Background" Value="{DynamicResource InfoBadgeSuccessSeverityBackgroundBrush}" />
<Setter TargetName="ContentBorder" Property="Background" Value="{DynamicResource SystemFillColorSuccessBackgroundBrush}" />
</Trigger>
<Trigger Property="Severity" Value="Caution">
<Setter TargetName="ContentBorder" Property="Background" Value="{DynamicResource InfoBadgeCautionSeverityBackgroundBrush}" />
<Setter TargetName="ContentBorder" Property="Background" Value="{DynamicResource SystemFillColorCautionBackgroundBrush}" />
</Trigger>
<Trigger Property="Severity" Value="Critical">
<Setter TargetName="ContentBorder" Property="Background" Value="{DynamicResource InfoBadgeCriticalSeverityBackgroundBrush}" />
<Setter TargetName="ContentBorder" Property="Background" Value="{DynamicResource SystemFillColorCriticalBackgroundBrush}" />
</Trigger>
</ControlTemplate.Triggers>
@@ -59,18 +54,18 @@
</Style>
<Style x:Key="IconInfoBadgeStyle" TargetType="{x:Type controls:InfoBadge}">
<Setter Property="Background">
<!--<Setter Property="Background">
<Setter.Value>
<SolidColorBrush Color="{DynamicResource InfoBadgeInformationSeverityBackgroundBrush}" />
</Setter.Value>
</Setter>
</Setter>-->
<Setter Property="Focusable" Value="False" />
<Setter Property="KeyboardNavigation.IsTabStop" Value="False" />
<Setter Property="SnapsToDevicePixels" Value="True" />
<Setter Property="Foreground" Value="{DynamicResource ButtonForeground}" />
<Setter Property="OverridesDefaultStyle" Value="True" />
<Setter Property="FontWeight" Value="Normal" />
<Setter Property="Foreground" Value="{DynamicResource TextFillColorPrimaryBrush}" />
<Setter Property="KeyboardNavigation.IsTabStop" Value="False" />
<Setter Property="OverridesDefaultStyle" Value="True" />
<Setter Property="SnapsToDevicePixels" Value="True" />
<Setter Property="Template">
<Setter.Value>
@@ -90,24 +85,21 @@
Content="{TemplateBinding Icon}"
Focusable="False"
TextElement.FontSize="{TemplateBinding FontSize}"
TextElement.Foreground="{DynamicResource InfoBadgeValueForeground}" />
TextElement.Foreground="{DynamicResource TextFillColorInverseBrush}" />
</Border>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="Severity" Value="Attention">
<Setter TargetName="ContentBorder" Property="Background" Value="{DynamicResource InfoBadgeAttentionSeverityBackgroundBrush}" />
</Trigger>
<Trigger Property="Severity" Value="Informational">
<Setter TargetName="ContentBorder" Property="Background" Value="{DynamicResource InfoBadgeInformationalSeverityBackgroundBrush}" />
<Setter TargetName="ContentBorder" Property="Background" Value="{DynamicResource SystemFillColorAttentionBrush}" />
</Trigger>
<Trigger Property="Severity" Value="Success">
<Setter TargetName="ContentBorder" Property="Background" Value="{DynamicResource InfoBadgeSuccessSeverityBackgroundBrush}" />
<Setter TargetName="ContentBorder" Property="Background" Value="{DynamicResource SystemFillColorSuccessBrush}" />
</Trigger>
<Trigger Property="Severity" Value="Caution">
<Setter TargetName="ContentBorder" Property="Background" Value="{DynamicResource InfoBadgeCautionSeverityBackgroundBrush}" />
<Setter TargetName="ContentBorder" Property="Background" Value="{DynamicResource SystemFillColorCautionBrush}" />
</Trigger>
<Trigger Property="Severity" Value="Critical">
<Setter TargetName="ContentBorder" Property="Background" Value="{DynamicResource InfoBadgeCriticalSeverityBackgroundBrush}" />
<Setter TargetName="ContentBorder" Property="Background" Value="{DynamicResource SystemFillColorCriticalBrush}" />
</Trigger>
</ControlTemplate.Triggers>
@@ -119,18 +111,17 @@
</Style>
<Style x:Key="ValueInfoBadgeStyle" TargetType="{x:Type controls:InfoBadge}">
<Setter Property="Background">
<!--<Setter Property="Background">
<Setter.Value>
<SolidColorBrush Color="{DynamicResource InfoBadgeInformationSeverityBackgroundBrush}" />
</Setter.Value>
</Setter>
</Setter>-->
<Setter Property="Focusable" Value="False" />
<Setter Property="KeyboardNavigation.IsTabStop" Value="False" />
<Setter Property="SnapsToDevicePixels" Value="True" />
<Setter Property="Foreground" Value="{DynamicResource ButtonForeground}" />
<Setter Property="OverridesDefaultStyle" Value="True" />
<Setter Property="FontWeight" Value="Normal" />
<Setter Property="Foreground" Value="{DynamicResource TextFillColorPrimaryBrush}" />
<Setter Property="KeyboardNavigation.IsTabStop" Value="False" />
<Setter Property="OverridesDefaultStyle" Value="True" />
<Setter Property="SnapsToDevicePixels" Value="True" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type controls:InfoBadge}">
@@ -142,20 +133,20 @@
MinWidth="16"
MinHeight="16"
Margin="{StaticResource IconBadgeMargin}"
Padding="3,0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Background="{TemplateBinding Background}"
BorderThickness="0"
CornerRadius="{StaticResource ValueInfoBadgeStyleCornerRadius}"
Opacity="{TemplateBinding Opacity}">
Opacity="{TemplateBinding Opacity}"
Padding="3,0">
<TextBlock
x:Name="TextBlock"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Focusable="False"
FontSize="{TemplateBinding FontSize}"
Foreground="{DynamicResource InfoBadgeValueForeground}"
Foreground="{DynamicResource TextFillColorInverseBrush}"
Text="{TemplateBinding Value}"
TextWrapping="Wrap" />
@@ -163,19 +154,16 @@
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="Severity" Value="Attention">
<Setter TargetName="ContentBorder" Property="Background" Value="{DynamicResource InfoBadgeAttentionSeverityBackgroundBrush}" />
</Trigger>
<Trigger Property="Severity" Value="Informational">
<Setter TargetName="ContentBorder" Property="Background" Value="{DynamicResource InfoBadgeInformationalSeverityBackgroundBrush}" />
<Setter TargetName="ContentBorder" Property="Background" Value="{DynamicResource SystemFillColorAttentionBrush}" />
</Trigger>
<Trigger Property="Severity" Value="Success">
<Setter TargetName="ContentBorder" Property="Background" Value="{DynamicResource InfoBadgeSuccessSeverityBackgroundBrush}" />
<Setter TargetName="ContentBorder" Property="Background" Value="{DynamicResource SystemFillColorSuccessBrush}" />
</Trigger>
<Trigger Property="Severity" Value="Caution">
<Setter TargetName="ContentBorder" Property="Background" Value="{DynamicResource InfoBadgeCautionSeverityBackgroundBrush}" />
<Setter TargetName="ContentBorder" Property="Background" Value="{DynamicResource SystemFillColorCautionBrush}" />
</Trigger>
<Trigger Property="Severity" Value="Critical">
<Setter TargetName="ContentBorder" Property="Background" Value="{DynamicResource InfoBadgeCriticalSeverityBackgroundBrush}" />
<Setter TargetName="ContentBorder" Property="Background" Value="{DynamicResource SystemFillColorCriticalBrush}" />
</Trigger>
@@ -188,4 +176,4 @@
<Style BasedOn="{StaticResource ValueInfoBadgeStyle}" TargetType="{x:Type controls:InfoBadge}" />
</ResourceDictionary>
</ResourceDictionary>

View File

@@ -7,27 +7,19 @@ namespace WPFluent.Controls;
public enum InfoBadgeSeverity
{
/// <summary>
/// Communicates that the InfoBadge is displaying general information that requires the user's attention.
/// 注意
/// </summary>
Attention = 0,
/// <summary>
/// Communicates that the InfoBadge is displaying general information that requires the user's attention.
/// 成功
/// </summary>
Informational = 1,
Success = 1,
/// <summary>
/// Communicates that the InfoBadge is displaying general information that requires the user's attention.
/// 警告
/// </summary>
Success = 2,
Caution = 2,
/// <summary>
/// Communicates that the InfoBadge is displaying general information that requires the user's attention.
/// 紧要、关键
/// </summary>
Caution = 3,
/// <summary>
/// Communicates that the InfoBadge is displaying general information that requires the user's attention.
/// </summary>
Critical = 4,
Critical = 3,
}