BadgeUpdateManager.GetTemplateContent | getTemplateContent method

Applies to Windows and Windows Phone

Gets the XML content of one of the predefined badge templates so that you can customize it for a badge update.


var xmlDocument = Windows.UI.Notifications.BadgeUpdateManager.getTemplateContent(type);



Type: BadgeTemplateType

The type of badge template, either a glyph or a number.

Return value

Type: XmlDocument

The object that contains the template XML.


Instead of creating the full XML payload yourself, you can get the default template and then use Document Object Model (DOM) manipulation functions to customize the part of the content that you want to change. You package this XML in a BadgeNotification and send it to the tile through the BadgeUpdater that you create through the other methods of this class.

See badge schema for an explanation of badge elements and attributes.


The following example shows the use of GetTemplateContent to get the content for a numeric badge.

var Notifications = Windows.UI.Notifications;

var badgeXml = Notifications.BadgeUpdateManager.getTemplateContent(Notifications.BadgeTemplateType.badgeNumber);
var badgeAttributes = badgeXml.getElementsByTagName("badge");
badgeAttributes[0].setAttribute("value", "7");


Minimum supported client

Windows 8

Minimum supported server

Windows Server 2012

Minimum supported phone

Windows Phone 8.1 [Windows Phone Silverlight 8.1 and Windows Runtime apps]


Windows::UI::Notifications [C++]



See also

App tiles and badges sample
Guidelines and checklist for tiles and badges
How to clear a badge
How to send a glyph or numeric badge in a local notification
How to set up periodic notifications for badges
How to update a badge through push notifications
Badge XML schema
Badge overview



© 2015 Microsoft