Badge notifications for Windows apps

A notification badge conveys summary or status information specific to your app. They can be numeric (1-99) or one of a set of system-provided glyphs. Examples of information best conveyed through a badge include network connection status in an online game, user status in a messaging app, number of unread mails in a mail app, and number of new posts in a social media app.

Notification badges appear on your app's taskbar icon and in the lower-right corner of its start tile, regardless of whether the app is running. Badges can be displayed on all tile sizes.

Note

You cannot provide your own badge image; only system-provided badge images can be used.

Numeric badges

Value Badge XML
A number from 1 to 99. A value of 0 is equivalent to the glyph value "none" and will clear the badge. A numeric badge less than 100. <badge value="1"/>
Any number greater than 99. A numeric badge greater than 99. <badge value="100"/>

Glyph badges

Instead of a number, a badge can display one of a non-extensible set of status glyphs.

Status Glyph XML
none (No badge shown.) <badge value="none"/>
activity A glyph badge denoting the 'activity' status. <badge value="activity"/>
alarm A glyph badge denoting the 'alarm' status. <badge value="alarm"/>
alert A glyph badge denoting the 'alert' status. <badge value="alert"/>
attention A glyph badge denoting the 'attention' status. <badge value="attention"/>
available A glyph badge denoting the 'available' status. <badge value="available"/>
away A glyph badge denoting the 'away' status. <badge value="away"/>
busy A glyph badge denoting the 'busy' status. <badge value="busy"/>
error A glyph badge denoting the 'error' status. <badge value="error"/>
newMessage A glyph badge denoting the 'newMessage' status. <badge value="newMessage"/>
paused A glyph badge denoting the 'paused' status. <badge value="paused"/>
playing A glyph badge denoting the 'playing' status. <badge value="playing"/>
unavailable A glyph badge denoting the 'unavailable' status. <badge value="unavailable"/>

Create a badge

These examples show you how to create a badge update.

Create a numeric badge

private void setBadgeNumber(int num)
{

    // Get the blank badge XML payload for a badge number
    XmlDocument badgeXml = 
        BadgeUpdateManager.GetTemplateContent(BadgeTemplateType.BadgeNumber);

    // Set the value of the badge in the XML to our number
    XmlElement badgeElement = badgeXml.SelectSingleNode("/badge") as XmlElement;
    badgeElement.SetAttribute("value", num.ToString());

    // Create the badge notification
    BadgeNotification badge = new BadgeNotification(badgeXml);

    // Create the badge updater for the application
    BadgeUpdater badgeUpdater = 
        BadgeUpdateManager.CreateBadgeUpdaterForApplication();

    // And update the badge
    badgeUpdater.Update(badge);

}

Create a glyph badge

private void updateBadgeGlyph()
{
    string badgeGlyphValue = "alert";

    // Get the blank badge XML payload for a badge glyph
    XmlDocument badgeXml = 
        BadgeUpdateManager.GetTemplateContent(BadgeTemplateType.BadgeGlyph);

    // Set the value of the badge in the XML to our glyph value
    Windows.Data.Xml.Dom.XmlElement badgeElement = 
        badgeXml.SelectSingleNode("/badge") as Windows.Data.Xml.Dom.XmlElement;
    badgeElement.SetAttribute("value", badgeGlyphValue);

    // Create the badge notification
    BadgeNotification badge = new BadgeNotification(badgeXml);

    // Create the badge updater for the application
    BadgeUpdater badgeUpdater = 
        BadgeUpdateManager.CreateBadgeUpdaterForApplication();

    // And update the badge
    badgeUpdater.Update(badge);

}

Clear a badge

private void clearBadge()
{
    BadgeUpdateManager.CreateBadgeUpdaterForApplication().Clear();
}

Get the sample code

  • Notifications sample
    Shows how to create live tiles, send badge updates, and display toast notifications.