共用方式為


Badge overview (Windows Runtime apps)

A notification badge conveys summary or status information specific to your app. They can be numeric (1-99) or one of a set of system-provided glyphs. Examples of information best conveyed through a badge include network connection status in an online game, user status in a messaging app, number of unread mails in a mail app, and number of new posts in a social media app. Badges can be displayed on all tile sizes. On Windows, they appear in the lower-right corner of the tile (lower-left corner on a computer set to a right-to-left (RTL) language). On Windows Phone 8.1, they appear in the upper-right corner of the tile (upper-left corner on a computer set to a right-to-left (RTL) language).

The following image shows a tile with a numeric badge displaying the number 12 to indicate 12 unread mails.

Note  You cannot provide your own badge image; only system-provided badge images can be used.

 

Specifying a badge

A badge is specified as XML content in a badge update notification. Its elements are defined in the badge schema.

Badge content options

Numeric badges

A badge can display any number from 1 to 99. Any value greater than 99 displays "99+" instead of the actual number. A value of 0 clears the badge from the tile.

Value Badge XML
A number from 1 to 99. A value of 0 is equivalent to the glyph value "none" and will clear the badge. <badge value="1"/>
Any number greater than 99. <badge value="100"/>

 

Glyph badges

Instead of a number, a badge can display one of a non-extensible set of status glyphs.

  • Windows glyphs
  • Windows Phone glyphs

Windows glyphs

The available glyphs for use with Windows are shown here, together with their XML equivalent in the badge template.

Status Glyph XML
none No badge shown <badge value="none"/>
activity <badge value="activity"/>
alarm <badge value="alarm"/>
alert <badge value="alert"/>
attention <badge value="attention"/>
available <badge value="available"/>
away <badge value="away"/>
busy <badge value="busy"/>
error <badge value="error"/>
newMessage <badge value="newMessage"/>
paused <badge value="paused"/>
playing <badge value="playing"/>
unavailable <badge value="unavailable"/>

 

Windows Phone glyphs

As of Windows Phone 8.1, the available glyphs for use with Windows Phone are shown here, together with their XML equivalent in the badge template. If you send one of the other Windows-supported glyphs, the badge on the phone, if showing, will clear.

Status Glyph XML
none No badge shown <badge value="none"/>
alert <badge value="alert"/>
attention <badge value="attention"/>

 

For more information on when and how to use a numeric badge versus a glyph badge, see Guidelines and checklist for tiles and badges.

App tiles and badges sample

Badge XML schema

How to send a glyph or numeric badge in a local notification

How to clear a badge

Guidelines and checklist for tiles and badges