2025-07-31 20:12:24 +08:00
<UserControl
d:DesignHeight="600"
d:DesignWidth="930"
mc:Ignorable="d"
x:Class="AntDesignWPFDemo.Views.BadgeView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:antd="https://github.com/ShrlAlgo/AntDesignWPF"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
2025-07-11 09:20:23 +08:00
<ScrollViewer>
2025-07-31 20:12:24 +08:00
<Grid Margin="16,0">
2025-07-11 09:20:23 +08:00
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<StackPanel>
2025-07-31 20:12:24 +08:00
<Label Content="Badge" Style="{StaticResource Ant.H1}" />
2025-07-11 09:20:23 +08:00
<TextBlock Style="{StaticResource Ant.P}" Text="Small numerical value or status descriptor for UI elements." />
2025-07-31 20:12:24 +08:00
<Label Content="When To Use" Style="{StaticResource Ant.H2}" />
2025-07-11 09:20:23 +08:00
<TextBlock Style="{StaticResource Ant.P}" Text="Badge normally appears in proximity to notifications or user avatars with eye-catching appeal, typically displaying unread messages count." />
2025-07-31 20:12:24 +08:00
<Label Content="Examples" Style="{StaticResource Ant.H2}" />
2025-07-11 09:20:23 +08:00
</StackPanel>
<Grid Grid.Row="1">
<Grid.Resources>
2025-07-31 20:12:24 +08:00
<Style TargetType="antd:Badge" x:Key="Badge">
<Setter Property="Margin" Value="0,20,20,0" />
2025-07-11 09:20:23 +08:00
</Style>
2025-07-31 20:12:24 +08:00
<Style TargetType="Rectangle" x:Key="HeadExample">
2025-07-11 09:20:23 +08:00
<Setter Property="Width" Value="42" />
<Setter Property="Height" Value="42" />
<Setter Property="RadiusX" Value="4" />
<Setter Property="RadiusY" Value="4" />
<Setter Property="Fill" Value="#EEEEEE" />
</Style>
</Grid.Resources>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
2025-07-31 20:12:24 +08:00
<StackPanel Margin="8,0">
2025-07-11 09:20:23 +08:00
<antd:CodeBox Title="Basic">
<antd:CodeBox.Description>
Simplest Usage. Badge will be hidden when count is 0, but we can use showZero to show it.
</antd:CodeBox.Description>
<antd:CodeBox.Content>
<WrapPanel>
2025-07-31 20:12:24 +08:00
<antd:Badge Count="5" Style="{StaticResource Badge}">
2025-07-11 09:20:23 +08:00
<Rectangle Style="{StaticResource HeadExample}" />
</antd:Badge>
2025-07-31 20:12:24 +08:00
<antd:Badge
Count="0"
ShowZero="True"
Style="{StaticResource Badge}">
2025-07-11 09:20:23 +08:00
<Rectangle Style="{StaticResource HeadExample}" />
</antd:Badge>
</WrapPanel>
</antd:CodeBox.Content>
<antd:CodeBox.Code>
2025-07-31 20:12:24 +08:00
<ResourceDictionary Source="pack://application:,,,/AntDesignWPF;component/Themes/Theme.xaml" />\n\n
xmlns:antd="https://github.com/ShrlAlgo/AntDesignWPF"\n\n
2025-07-11 09:20:23 +08:00
<Style x:Key="Badge" TargetType="antd:Badge">\n
2025-07-31 20:12:24 +08:00
\t<Setter Property="Margin" Value="0 20 20 0" />\n
2025-07-11 09:20:23 +08:00
</Style>\n
<Style x:Key="HeadExample" TargetType="Rectangle">\n
2025-07-31 20:12:24 +08:00
\t<Setter Property="Width" Value="42" />\n
\t<Setter Property="Height" Value="42" />\n
\t<Setter Property="RadiusX" Value="4" />\n
\t<Setter Property="RadiusY" Value="4" />\n
\t<Setter Property="Fill" Value="#EEEEEE" />\n
2025-07-11 09:20:23 +08:00
</Style>\n\n
<WrapPanel>\n
2025-07-31 20:12:24 +08:00
\t<antd:Badge Style="{StaticResource Badge}" Count="5">\n
\t\t<Rectangle Style="{StaticResource HeadExample}" />\n
\t</antd:Badge>\n
\t<antd:Badge Style="{StaticResource Badge}" Count="0" ShowZero="True">\n
\t\t<Rectangle Style="{StaticResource HeadExample}" />\n
\t</antd:Badge>\n
2025-07-11 09:20:23 +08:00
</WrapPanel>
</antd:CodeBox.Code>
</antd:CodeBox>
<antd:CodeBox Title="Overflow Count">
<antd:CodeBox.Description>
`${OverflowCount}+` is displayed when count is larger than `OverflowCount`. The default value of `OverflowCount` is 99.
</antd:CodeBox.Description>
<antd:CodeBox.Content>
<WrapPanel>
2025-07-31 20:12:24 +08:00
<antd:Badge Count="99" Style="{StaticResource Badge}">
2025-07-11 09:20:23 +08:00
<Rectangle Style="{StaticResource HeadExample}" />
</antd:Badge>
2025-07-31 20:12:24 +08:00
<antd:Badge Count="100" Style="{StaticResource Badge}">
2025-07-11 09:20:23 +08:00
<Rectangle Style="{StaticResource HeadExample}" />
</antd:Badge>
2025-07-31 20:12:24 +08:00
<antd:Badge
Count="99"
OverflowCount="10"
Style="{StaticResource Badge}">
2025-07-11 09:20:23 +08:00
<Rectangle Style="{StaticResource HeadExample}" />
</antd:Badge>
2025-07-31 20:12:24 +08:00
<antd:Badge
Count="1000"
OverflowCount="999"
Style="{StaticResource Badge}">
2025-07-11 09:20:23 +08:00
<Rectangle Style="{StaticResource HeadExample}" />
</antd:Badge>
</WrapPanel>
</antd:CodeBox.Content>
<antd:CodeBox.Code>
2025-07-31 20:12:24 +08:00
<ResourceDictionary Source="pack://application:,,,/AntDesignWPF;component/Themes/Theme.xaml" />\n\n
xmlns:antd="https://github.com/ShrlAlgo/AntDesignWPF"\n\n
2025-07-11 09:20:23 +08:00
<Style x:Key="Badge" TargetType="antd:Badge">\n
2025-07-31 20:12:24 +08:00
\t<Setter Property="Margin" Value="0 20 20 0" />\n
2025-07-11 09:20:23 +08:00
</Style>\n
<Style x:Key="HeadExample" TargetType="Rectangle">\n
2025-07-31 20:12:24 +08:00
\t<Setter Property="Width" Value="42" />\n
\t<Setter Property="Height" Value="42" />\n
\t<Setter Property="RadiusX" Value="4" />\n
\t<Setter Property="RadiusY" Value="4" />\n
\t<Setter Property="Fill" Value="#EEEEEE" />\n
2025-07-11 09:20:23 +08:00
</Style>\n\n
<WrapPanel>\n
2025-07-31 20:12:24 +08:00
\t<antd:Badge Style="{StaticResource Badge}" Count="99">\n
\t\t<Rectangle Style="{StaticResource HeadExample}" />\n
\t</antd:Badge>\n
\t<antd:Badge Style="{StaticResource Badge}" Count="100">\n
\t\t<Rectangle Style="{StaticResource HeadExample}" />\n
\t</antd:Badge>\n
\t<antd:Badge Style="{StaticResource Badge}" Count="99" OverflowCount="10">\n
\t\t<Rectangle Style="{StaticResource HeadExample}" />\n
\t</antd:Badge>\n
\t<antd:Badge Style="{StaticResource Badge}" Count="1000" OverflowCount="999">\n
\t\t<Rectangle Style="{StaticResource HeadExample}" />\n
\t</antd:Badge>\n
2025-07-11 09:20:23 +08:00
</WrapPanel>
</antd:CodeBox.Code>
</antd:CodeBox>
<antd:CodeBox Title="Status">
<antd:CodeBox.Description>
Standalone badge with status.
</antd:CodeBox.Description>
<antd:CodeBox.Content>
<StackPanel>
2025-07-31 20:12:24 +08:00
<StackPanel Margin="0,0,0,16" Orientation="Horizontal">
2025-07-11 09:20:23 +08:00
<antd:Badge Status="Success" />
<antd:Badge Status="Error" />
<antd:Badge Status="Default" />
<antd:Badge Status="Processing" />
<antd:Badge Status="Warning" />
</StackPanel>
<StackPanel>
<antd:Badge Status="Success" Text="Success" />
<antd:Badge Status="Error" Text="Error" />
<antd:Badge Status="Default" Text="Default" />
<antd:Badge Status="Processing" Text="Processing" />
<antd:Badge Status="Warning" Text="Warning" />
</StackPanel>
</StackPanel>
</antd:CodeBox.Content>
<antd:CodeBox.Code>
2025-07-31 20:12:24 +08:00
<ResourceDictionary Source="pack://application:,,,/AntDesignWPF;component/Themes/Theme.xaml" />\n\n
xmlns:antd="https://github.com/ShrlAlgo/AntDesignWPF"\n\n
2025-07-11 09:20:23 +08:00
<StackPanel>\n
2025-07-31 20:12:24 +08:00
\t<StackPanel Orientation="Horizontal" Margin="0 0 0 16">\n
\t\t<antd:Badge Status="Success" />\n
\t\t<antd:Badge Status="Error" />\n
\t\t<antd:Badge Status="Default" />\n
\t\t<antd:Badge Status="Processing" />\n
\t\t<antd:Badge Status="Warning" />\n
\t</StackPanel>\n
\t<StackPanel>\n
\t\t<antd:Badge Status="Success" Text="Success" />\n
\t\t<antd:Badge Status="Error" Text="Error" />\n
\t\t<antd:Badge Status="Default" Text="Default" />\n
\t\t<antd:Badge Status="Processing" Text="Processing" />\n
\t\t<antd:Badge Status="Warning" Text="Warning" />\n
\t</StackPanel>\n
2025-07-11 09:20:23 +08:00
</StackPanel>
</antd:CodeBox.Code>
</antd:CodeBox>
</StackPanel>
2025-07-31 20:12:24 +08:00
<StackPanel Grid.Column="1" Margin="8,0">
2025-07-11 09:20:23 +08:00
<antd:CodeBox Title="Standalone">
<antd:CodeBox.Description>
Used in standalone when children is empty.
</antd:CodeBox.Description>
<antd:CodeBox.Content>
<WrapPanel>
<antd:Badge Count="25" />
2025-07-31 20:12:24 +08:00
<antd:Badge
BadgeBackground="White"
BadgeForeground="#999"
Count="4" />
<antd:Badge BadgeBackground="#52c41a" Count="109" />
2025-07-11 09:20:23 +08:00
</WrapPanel>
</antd:CodeBox.Content>
<antd:CodeBox.Code>
2025-07-31 20:12:24 +08:00
<ResourceDictionary Source="pack://application:,,,/AntDesignWPF;component/Themes/Theme.xaml" />\n\n
xmlns:antd="https://github.com/ShrlAlgo/AntDesignWPF"\n\n
2025-07-11 09:20:23 +08:00
<WrapPanel Orientation="Horizontal">\n
2025-07-31 20:12:24 +08:00
\t<antd:Button Type="Primary" Content="Primary" />\n
\t<antd:Button Content="Default" />\n
\t<antd:Button Type="Dashed" Content="Dashed" />\n
\t<antd:Button Type="Danger" Content="Danger" />\n
2025-07-11 09:20:23 +08:00
</WrapPanel>
</antd:CodeBox.Code>
</antd:CodeBox>
<antd:CodeBox Title="Red badge">
<antd:CodeBox.Description>
This will simply display a red badge, without a specific count. If count equals 0, it won't display the dot.
</antd:CodeBox.Description>
<antd:CodeBox.Content>
<WrapPanel>
<antd:Badge Dot="True">
2025-07-31 20:12:24 +08:00
<antd:Icon Foreground="Black" Type="notification" />
2025-07-11 09:20:23 +08:00
</antd:Badge>
<antd:Badge Count="0" Dot="True">
<antd:Icon Type="notification" />
</antd:Badge>
<antd:Badge Dot="True">
<Hyperlink>Link something</Hyperlink>
</antd:Badge>
</WrapPanel>
</antd:CodeBox.Content>
<antd:CodeBox.Code>
2025-07-31 20:12:24 +08:00
<ResourceDictionary Source="pack://application:,,,/AntDesignWPF;component/Themes/Theme.xaml" />\n\n
xmlns:antd="https://github.com/ShrlAlgo/AntDesignWPF"\n\n
2025-07-11 09:20:23 +08:00
<WrapPanel Orientation="Horizontal">\n
2025-07-31 20:12:24 +08:00
\t<antd:Button Type="Primary" Content="Primary" />\n
\t<antd:Button Content="Default" />\n
\t<antd:Button Type="Dashed" Content="Dashed" />\n
\t<antd:Button Type="Danger" Content="Danger" />\n
2025-07-11 09:20:23 +08:00
</WrapPanel>
</antd:CodeBox.Code>
</antd:CodeBox>
<antd:CodeBox Title="ToolTip">
<antd:CodeBox.Description>
The badge will display `ToolTip` when hovered over, instead of `Count`.
</antd:CodeBox.Description>
<antd:CodeBox.Content>
<WrapPanel>
<antd:Badge Count="5" ToolTip="Badge ToolTip">
2025-07-31 20:12:24 +08:00
<Rectangle Style="{StaticResource HeadExample}" ToolTip="Content ToolTip" />
2025-07-11 09:20:23 +08:00
</antd:Badge>
</WrapPanel>
</antd:CodeBox.Content>
<antd:CodeBox.Code>
2025-07-31 20:12:24 +08:00
<ResourceDictionary Source="pack://application:,,,/AntDesignWPF;component/Themes/Theme.xaml" />\n\n
xmlns:antd="https://github.com/ShrlAlgo/AntDesignWPF"\n\n
2025-07-11 09:20:23 +08:00
<WrapPanel Orientation="Horizontal">\n
2025-07-31 20:12:24 +08:00
\t<antd:Button Type="Primary" Content="Primary" />\n
\t<antd:Button Content="Default" />\n
\t<antd:Button Type="Dashed" Content="Dashed" />\n
\t<antd:Button Type="Danger" Content="Danger" />\n
2025-07-11 09:20:23 +08:00
</WrapPanel>
</antd:CodeBox.Code>
</antd:CodeBox>
</StackPanel>
</Grid>
</Grid>
</ScrollViewer>
</UserControl>