Windows desktop applications
Collapse the table of content
Expand the table of content
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

BadgeNotification class

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


Public NotInheritable Class BadgeNotification

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-only

Gets the XML that defines the value or glyph used as the tile's badge.

ExpirationTime

Read/write

Gets 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 (Windows 10 device family)

Device family

Universal, introduced version 10.0.10240.0 [for Xbox, see UWP features that aren't yet supported on Xbox]

API contract

Windows.Foundation.UniversalApiContract, introduced version 1.0

Namespace

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

Metadata

Windows.Foundation.UniversalApiContract.winmd

Requirements (Windows 8.x and Windows Phone 8.x)

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

Attributes

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

See also

Object
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:
© 2016 Microsoft