Dela via


BadgeUpdateManager.GetTemplateContent(BadgeTemplateType) Method

Definition

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

public:
 static XmlDocument ^ GetTemplateContent(BadgeTemplateType type);
 static XmlDocument GetTemplateContent(BadgeTemplateType const& type);
public static XmlDocument GetTemplateContent(BadgeTemplateType type);
function getTemplateContent(type)
Public Shared Function GetTemplateContent (type As BadgeTemplateType) As XmlDocument

Parameters

type
BadgeTemplateType

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

Returns

The object that contains the template XML.

Examples

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");

Remarks

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 schemafor an explanation of badge elements and attributes.

Applies to

See also