Click here to Skip to main content
13,048,584 members (79,721 online)
Click here to Skip to main content
Add your own
alternative version


5 bookmarked
Posted 28 Jun 2012

Badge Notifications in Windows 8

, 28 Jun 2012
Rate this:
Please Sign up or sign in to vote.
It shows how to display a badge notification in Windows 8 metro app


Badge is a type of Push Notification available in Windows 8. It is displayed over the top of a tile. Badges are small icons that are shown in the lower right corner of a tile. The tile can either be a default tile or a tile with a notification.

A badge can display either a number from 1-99 or a status glyph. Now it is to be noticed that 99 is the largest number to be displayed as a badge. Even if you provide a number larger than 99, it will show badge notification as 99 only.You can have a full overview about number badges and glyph badges from here.

Using the code

Displaying a badge is similar to displaying a notification. So at first the following namespaces should be included:

Using Windows.UI.Notifications;
Using Windows.Data.Xml.Dom;

The following code is used for displaying a badge in Windows 8 metro App :

XmlDocument xmldoc = BadgeUpdateManager.GetTemplateContent(BadgeTemplateType.BadgeNumber);
XmlElement textnode = (XmlElement)xmldoc.SelectSingleNode("/badge");
textnode.SetAttribute("value", "available");
BadgeNotification not = new BadgeNotification(xmldoc);

Now we will learn what the following statements will do.The first line gets the blank XML badge template for a numeric badge. For a glyph badge, the code will be:

XmlDocument xmldoc = BadgeUpdateManager.GetTemplateContent(BadgeTemplateType.BadgeGylph);

The schema for both types of badges are same i.e. <badge value=””/>

The next two lines set the value attribute in the schema. For the number badge this will be one or two digits. For the glyph badge it will be one of the following values: none, activity, alert, available, away, busy, newMessage, paused, playing, unavailable, error.

The last two lines packages the XML into a notification and creates a badge object and display it on the tile.

Points of Interest

The Badge Notification will look like this in the tile:

The first image shows numeric badge while the second one shows gylph badge

We can also remove the badge notification with the help of following code:


Now you all must be thinking that what is the usefulness of this badge or where this badge needs to be used?????

A Badge can be used –

  • To show no. of unread mails in a mail application
  • To show no. of online members in a chat
  • To display the chat status
  • To display the current level of game being played


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

India India
No Biography provided

You may also be interested in...

Comments and Discussions

GeneralMy vote of 5 Pin
VistaaR7-Aug-12 21:07
memberVistaaR7-Aug-12 21:07 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.170713.1 | Last Updated 28 Jun 2012
Article Copyright 2012 by ROHIT SHAW
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid