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

@@ -4,7 +4,7 @@
/// 用于突出显示项目、吸引注意力或标记状态。
/// </summary>
/// <example>
/// <code lang="xml"> /// &lt;ui:Badge Appearance="Secondary"&gt; /// &lt;TextBox Text="Hello" /&gt; ///
/// <code lang="xml"> /// &lt;ui:Badge Appearance="Accent"&gt; /// &lt;TextBox Text="Hello" /&gt; ///
/// &lt;/ui:Badge&gt; ///</code>
/// </example>
public class Badge : System.Windows.Controls.ContentControl, IAppearanceControl

View File

@@ -1,18 +1,14 @@
<!--
This Source Code Form is subject to the terms of the MIT License.
If a copy of the MIT was not distributed with this file, You can obtain one at https://opensource.org/licenses/MIT.
Copyright (C) Leszek Pomianowski and WPF UI Contributors.
All Rights Reserved.
-->
<ResourceDictionary
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="clr-namespace:WPFluent.Controls">
xmlns:controls="clr-namespace:WPFluent.Controls"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<!--<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/WPFluent;component/Themes/Light.xaml"/>
</ResourceDictionary.MergedDictionaries>-->
<Style TargetType="{x:Type controls:Badge}">
<Setter Property="Foreground" Value="{DynamicResource BadgeForeground}" />
<Setter Property="Background" Value="{DynamicResource BadgeBackground}" />
<Setter Property="BorderBrush" Value="{DynamicResource SystemAccentBrush}" />
<Setter Property="Foreground" Value="{DynamicResource TextOnAccentFillColorPrimaryBrush}" />
<Setter Property="Background" Value="{DynamicResource SystemFillColorAttentionBrush}" />
<!-- <Setter Property="BorderBrush" Value="{DynamicResource SystemAccentBrush}" /> -->
<Setter Property="BorderBrush" Value="Transparent" />
<Setter Property="Padding" Value="4" />
<Setter Property="Focusable" Value="False" />
@@ -22,47 +18,33 @@
<Setter.Value>
<ControlTemplate TargetType="{x:Type controls:Badge}">
<Border
x:Name="Border"
Padding="{TemplateBinding Padding}"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="1"
CornerRadius="4">
<ContentPresenter VerticalAlignment="Center"/>
CornerRadius="4"
Padding="{TemplateBinding Padding}"
x:Name="Border">
<ContentPresenter VerticalAlignment="Center" />
</Border>
<ControlTemplate.Triggers>
<Trigger Property="Appearance" Value="Primary">
<Setter Property="Foreground" Value="{DynamicResource BadgeForeground}" />
<Trigger Property="Appearance" Value="Accent">
<Setter Property="Foreground" Value="{DynamicResource TextOnAccentFillColorPrimaryBrush}" />
</Trigger>
<Trigger Property="Appearance" Value="Transparent">
<Setter Property="BorderBrush" Value="{DynamicResource ControlElevationBorderBrush}" />
<Setter TargetName="Border" Property="Background" Value="Transparent" />
<Setter Property="Background" TargetName="Border" Value="Transparent" />
</Trigger>
<Trigger Property="Appearance" Value="Secondary">
<Setter Property="BorderBrush" Value="{DynamicResource ControlElevationBorderBrush}" />
<Setter TargetName="Border" Property="Background" Value="{DynamicResource ControlFillColorDefaultBrush}" />
</Trigger>
<Trigger Property="Appearance" Value="Info">
<Setter TargetName="Border" Property="Background" Value="{DynamicResource PaletteLightBlueBrush}" />
<Trigger Property="Appearance" Value="Attention">
<Setter Property="Background" TargetName="Border" Value="{DynamicResource SystemFillColorAttentionBrush}" />
</Trigger>
<Trigger Property="Appearance" Value="Caution">
<Setter TargetName="Border" Property="Background" Value="{DynamicResource PaletteOrangeBrush}" />
<Setter Property="Background" TargetName="Border" Value="{DynamicResource SystemFillColorCautionBrush}" />
</Trigger>
<Trigger Property="Appearance" Value="Danger">
<Setter TargetName="Border" Property="Background" Value="{DynamicResource PaletteRedBrush}" />
<Trigger Property="Appearance" Value="Critical">
<Setter Property="Background" TargetName="Border" Value="{DynamicResource SystemFillColorCriticalBrush}" />
</Trigger>
<Trigger Property="Appearance" Value="Success">
<Setter TargetName="Border" Property="Background" Value="{DynamicResource PaletteGreenBrush}" />
</Trigger>
<Trigger Property="Appearance" Value="Dark">
<Setter TargetName="Border" Property="Background" Value="{DynamicResource ControlStrongFillColorDarkBrush}" />
<Setter Property="Foreground" Value="{DynamicResource TextFillColorLightPrimaryBrush}" />
<Setter Property="BorderBrush" Value="{DynamicResource ControlElevationBorderBrush}" />
</Trigger>
<Trigger Property="Appearance" Value="Light">
<Setter TargetName="Border" Property="Background" Value="{DynamicResource ControlStrongFillColorLightBrush}" />
<Setter Property="Foreground" Value="{DynamicResource TextFillColorDarkPrimaryBrush}" />
<Setter Property="BorderBrush" Value="{DynamicResource ControlElevationBorderBrush}" />
<Setter Property="Background" TargetName="Border" Value="{DynamicResource SystemFillColorSuccessBrush}" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>