Loading...
Loading...
Compare original and translation side by side
SfBadgeSfBadgeSfBadgeBadgeContainerSfBadgeBadgeContainerBadgeContainer<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>BadgeContainer<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>CustomShapeCustomShapeInstall-Package Syncfusion.Notifications.WinUIInstall-Package Syncfusion.Notifications.WinUIxmlns:notification="using:Syncfusion.UI.Xaml.Notifications"xmlns: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="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>
<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><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"/><!-- 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"/>// 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><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 |
| 问题 | 解决方案 |
|---|---|
| 徽章不可见 | 检查Visibility属性,确保已设置Content,验证父容器尺寸 |
| 位置不正确 | 检查HorizontalAnchor/VerticalAnchor值,查看对齐属性 |
| 内容被截断 | 增加Width/Height或调整Padding |
| 颜色未生效 | Background会覆盖Fill - 只使用其中一个 |
| 动画不工作 | 动画仅在Content变化时触发,确认已设置AnimationType |
| 徽章未叠加 | 确保使用的是BadgeContainer,而非独立徽章 |