BadgeNotification class

Applies to Windows and Windows Phone

Defines the content, associated metadata, and expiration time of an update to a tile's badge overlay. A badge can display a number from 1 to 99 or a status glyph.

Syntax


var badgeNotification = new Windows.UI.Notifications.BadgeNotification();

Attributes

[Threading(MTA)]
[Version(0x06020000)]

Members

The BadgeNotification class has these types of members:

Constructors

The BadgeNotification class has these constructors.

ConstructorDescription
BadgeNotification Creates and initializes a new instance of the BadgeNotification.

 

Properties

The BadgeNotification class has these properties.

PropertyAccess typeDescription

Content

Read-onlyGets the XML that defines the value or glyph used as the tile's badge.

ExpirationTime

Read/writeGets or sets the time that Windows will remove the badge from the tile.

 

Examples

The following example code uses the BadgeNotification method to create a numeric badge notification. If you used this method to set the value to "0", it would clear the badge.



var Notifications = Windows.UI.Notifications;

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

// Create a badge notification from XML
var badgeNotification = new Notifications.badgeNotification(badgeXml);

The following example code uses the BadgeNotification method to create a glyph badge notification. If you used this method to set the value to "none", it would clear the badge.



var Notifications = Windows.UI.Notifications;

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

// Create a badge notification from XML
var badgeNotification = new Notifications.badgeNotification(badgeXml);

Requirements

Minimum supported client

Windows 8 [Windows Store apps only]

Minimum supported server

Windows Server 2012 [Windows Store apps only]

Minimum supported phone

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

Namespace

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

Metadata

Windows.winmd

See also

App tiles and badges sample
Badge overview
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

 

 

Show:
© 2014 Microsoft