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
- ActivatableAttribute(Windows.UI.Notifications.IBadgeNotificationFactory, NTDDI_WIN8)
- ThreadingAttribute(MTA)
- VersionAttribute(NTDDI_WIN8)
Members
The BadgeNotification class has these types of members:
Constructors
The BadgeNotification class has these constructors.
| Constructor | Description |
|---|---|
| BadgeNotification | Creates and initializes a new instance of the BadgeNotification. |
Methods
The BadgeNotification class inherits methods from the Object class (C#/VB/C++).
Properties
The BadgeNotification class has these properties.
| Property | Access type | Description |
|---|---|---|
| Read-only | Gets the XML that defines the value or glyph used as the tile's badge. | |
| 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
|
Minimum supported client | Windows 8 [Windows Store apps only] |
|---|---|
|
Minimum supported server | Windows Server 2012 [Windows Store apps only] |
|
Namespace |
|
|
Metadata |
|
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
Build date: 12/4/2012