TileNotification.ExpirationTime TileNotification.ExpirationTime TileNotification.ExpirationTime TileNotification.ExpirationTime TileNotification.ExpirationTime Property

Definition

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; }
IReference<DateTime> ExpirationTime();

void ExpirationTime(IReference<DateTime> expirationtime);
public Nullable<DateTimeOffset> ExpirationTime { get; set; }
Public ReadWrite Property ExpirationTime As Nullable<DateTimeOffset>
var nullable = tileNotification.expirationTime;
tileNotification.expirationTime = nullable;

Property Value

Nullable<DateTimeOffset> Nullable<DateTimeOffset> Nullable<DateTimeOffset>

The date and time that the notification should be removed.

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