Loading...
Loading...
Guide implementation of the Syncfusion WinUI Badge control (SfBadge) for displaying notification badges and status indicators. Use this skill when working with badge notifications, unread count badges, BadgeContainer, or notification overlays in WinUI applications. Covers shapes, colors, positioning, alignment, animations, and customization patterns.
npx skill4agent add syncfusion/winui-ui-components-skills syncfusion-winui-badgeSfBadgeSfBadgeBadgeContainerBadgeContainer<notification:BadgeContainer>
<notification:BadgeContainer.Content>
<Button Content="Inbox"/>
</notification:BadgeContainer.Content>
<notification:BadgeContainer.Badge>
<notification:SfBadge Content="10" Fill="Success"/>
</notification:BadgeContainer.Badge>
</notification:BadgeContainer>CustomShapeInstall-Package Syncfusion.Notifications.WinUIxmlns:notification="using:Syncfusion.UI.Xaml.Notifications"<notification:BadgeContainer>
<notification:BadgeContainer.Content>
<Button Content="Notifications" Width="120" Height="40"/>
</notification:BadgeContainer.Content>
<notification:BadgeContainer.Badge>
<notification:SfBadge Content="5" Fill="Error"/>
</notification:BadgeContainer.Badge>
</notification:BadgeContainer><notification:BadgeContainer>
<notification:BadgeContainer.Content>
<Button Content="Messages" FontSize="16"/>
</notification:BadgeContainer.Content>
<notification:BadgeContainer.Badge>
<notification:SfBadge Content="{x:Bind UnreadCount, Mode=OneWay}"
Fill="Error"
Shape="Ellipse"/>
</notification:BadgeContainer.Badge>
</notification:BadgeContainer><notification:BadgeContainer>
<notification:BadgeContainer.Content>
<PersonPicture Width="60" Height="60" ProfilePicture="/Assets/user.png"/>
</notification:BadgeContainer.Content>
<notification:BadgeContainer.Badge>
<notification:SfBadge Shape="None"
HorizontalPosition="0.85"
VerticalPosition="0.85">
<Ellipse Width="16" Height="16" Fill="LimeGreen"/>
</notification:SfBadge>
</notification:BadgeContainer.Badge>
</notification:BadgeContainer><!-- Success Badge -->
<notification:SfBadge Content="Verified"
Fill="Success"
Shape="Rectangle"/>
<!-- Warning Badge -->
<notification:SfBadge Content="!"
Fill="Warning"
Shape="Ellipse"/>
<!-- Error Badge -->
<notification:SfBadge Content="Error"
Fill="Error"
Shape="Oval"/>// Converter to format large numbers
public class CountFormatConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, string language)
{
if (int.TryParse(value?.ToString(), out int count))
{
if (count <= 99) return count.ToString();
if (count <= 999) return "99+";
if (count < 99999) return (count / 1000).ToString("0.#") + "K";
return (count / 1000000).ToString("0.#") + "M";
}
return value;
}
public object ConvertBack(object value, Type targetType, object parameter, string language)
{
throw new NotImplementedException();
}
}<Page.Resources>
<local:CountFormatConverter x:Key="countFormatter"/>
</Page.Resources>
<notification:SfBadge Content="{x:Bind Count, Mode=OneWay, Converter={StaticResource countFormatter}}"
Background="Red"
Foreground="White"/><ListView ItemsSource="{x:Bind MailItems}">
<ListView.ItemTemplate>
<DataTemplate x:DataType="local:MailItem">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TextBlock Text="{x:Bind FolderName}"
VerticalAlignment="Center"/>
<notification:SfBadge Grid.Column="1"
Content="{x:Bind UnreadCount}"
Fill="Warning"
Shape="Oval"
Visibility="{x:Bind HasUnread}"/>
</Grid>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>| Issue | Solution |
|---|---|
| Badge not visible | Check Visibility property, ensure Content is set, verify parent container size |
| Position incorrect | Review HorizontalAnchor/VerticalAnchor values, check alignment properties |
| Content cut off | Increase Width/Height or adjust Padding |
| Color not applying | Background overrides Fill - use one or the other |
| Animation not working | Animation only triggers on Content change, verify AnimationType is set |
| Badge not overlapping | Ensure using BadgeContainer, not standalone Badge |