Tile​Notification Tile​Notification Tile​Notification Class

Definition

Defines an update to a tile, including its visuals, identification tag, and expiration time.

public sealed class TileNotification : ITileNotificationpublic sealed class TileNotification : ITileNotificationPublic NotInheritable Class TileNotification Implements ITileNotification
Attributes
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0 - for Xbox, see UWP features that aren't yet supported on Xbox)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Remarks

Examples

The following example uses the @Windows.UI.Notifications.TileNotification.#ctor(Windows.Data.Xml.Dom.XmlDocument)?text=TileNotification constructor to create a new instance, then uses the ExpirationTime property to show a tile notification for 30 seconds.


function tileNotificationExpiration() {
    var Notifications = Windows.UI.Notifications;
    var tileXml = Notifications.TileUpdateManager.getTemplateContent(Notifications.TileTemplateType.tileWide310x150Text04);

    var currentTime = new Date();
    var seconds = 30;

    var tileTextAttributes = tileXml.getElementsByTagName("text");
    tileTextAttributes[0].appendChild(tileXml.createTextNode("This notification will expire at " + new Date(currentTime.getTime() + seconds * 1000)));

    var tileNotification = new Notifications.TileNotification(tileXml);

    // Set the expiration time on the notification
    var expiryTime = new Date(currentTime.getTime() + seconds * 1000);

    tileNotification.expirationTime = expiryTime;
    Notifications.TileUpdateManager.createTileUpdaterForApplication().update(tileNotification);
}

Constructors

TileNotification(XmlDocument) TileNotification(XmlDocument) TileNotification(XmlDocument)

Creates and initializes a new instance of the TileNotification object for use with a TileUpdater.

public TileNotification(XmlDocument content)public TileNotification(XmlDocument content)Public Sub New(content As XmlDocument)
Parameters
content
XmlDocument XmlDocument XmlDocument

The object that provides the content for the tile notification.

Attributes
See Also

Properties

Content Content Content

Gets the XML description of the notification content, which you can then manipulate to alter the notification.

public XmlDocument Content { get; }public XmlDocument Content { get; }Public ReadOnly Property Content As XmlDocument
Value
XmlDocument XmlDocument XmlDocument

The object that contains the notification content.

Attributes

Remarks

The retrieved elements and their attributes are manipulated through Document Object Model (DOM) manipulation functions to customize the tile content. See tile schema for an explanation of tile elements and attributes found in the XML document.

See Also

ExpirationTime ExpirationTime ExpirationTime

Gets or sets the time that Windows will remove the notification from the tile. By default, a tile update does not expire. It is a best practice to explicitly set an expiration time to avoid stale content.

public IReference<DateTime> ExpirationTime { get; set; }public IReference<DateTime> ExpirationTime { get; set; }Public ReadWrite Property ExpirationTime As IReference<DateTime>
Value

The date and time that the notification should be removed.

Attributes

Remarks

Examples

The following example uses ExpirationTime to show a tile notification for 30 seconds.



function tileNotificationExpiration() {

    var Notifications = Windows.UI.Notifications;

    var tileXml = Notifications.TileUpdateManager.getTemplateContent(Notifications.TileTemplateType.tileWide310x150Text04);



    var currentTime = new Date();

    var seconds = 30;



    var tileTextAttributes = tileXml.getElementsByTagName("text");

    tileTextAttributes[0].appendChild(tileXml.createTextNode("This notification will expire at " + new Date(currentTime.getTime() + seconds * 1000)));



    var tileNotification = new Notifications.TileNotification(tileXml);



    // Set the expiration time on the notification

    var expiryTime = new Date(currentTime.getTime() + seconds * 1000);



    tileNotification.expirationTime = expiryTime;

    Notifications.TileUpdateManager.createTileUpdaterForApplication().update(tileNotification);

}
See Also

Tag Tag Tag

Gets or sets a string that Windows can use to prevent duplicate notification content from appearing in the queue.

public string Tag { get; set; }public string Tag { get; set; }Public ReadWrite Property Tag As string
Value
string string string

A string of 16 characters or less (plus a terminating null character) that identifies the notification in the stack. While there is no set form to the string content, we recommend that it should relate to the content of the notification.

Attributes

Remarks

Use tags to replace notifications in the stack. If a new notification arrives with the same tag as an existing notification, the new notification replaces the old. For instance, if your tile shows stock prices, you want to show the most up-to-date info. An existing stock price update waiting in the queue to be displayed should be replaced by the latest quotes rather than showing them one after the other.

A new notification with a matching tag replaces any existing notification with the same tag, but the new notification does not necessarily inherit the older notification's place in the queue.

The tag should relate to the content of the notification. For example, a notification in a stock quote app could use the stock symbol (such as "msft") while a weather app notification could be tagged with the zip code (such as "98052") of the forecast. Do not simply number your notifications as "notification1", "notification2" and so on.

See Also

See Also