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 <badge value="activity"/>
alarm <badge value="alarm"/>
alert <badge value="alert"/>
attention <badge value="attention"/>
available <badge value="available"/>
away <badge value="away"/>
busy <badge value="busy"/>
error <badge value="error"/>
newMessage <badge value="newMessage"/>
paused <badge value="paused"/>
playing <badge value="playing"/>
unavailable <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.