TileNotification.ExpirationTime Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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:
property IReference<DateTime> ^ ExpirationTime { IReference<DateTime> ^ get(); void set(IReference<DateTime> ^ value); };
IReference<DateTime> ExpirationTime();
void ExpirationTime(IReference<DateTime> value);
public System.Nullable<System.DateTimeOffset> ExpirationTime { get; set; }
var iReference = tileNotification.expirationTime;
tileNotification.expirationTime = iReference;
Public Property ExpirationTime As Nullable(Of DateTimeOffset)
Property Value
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);
}
Applies to
See also
- How to use the notification queue with local notifications
- App tiles and badges sample
- Quickstart: Sending a tile update
- Tile and tile notification overview
- The tile template catalog
- Guidelines and checklist for tiles
- How to schedule a tile notification
- How to set up periodic notifications for tiles
- Tiles XML schema