Share via


TileNotification Class

Definition

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

public ref class TileNotification sealed
/// [Windows.Foundation.Metadata.Activatable(Windows.UI.Notifications.ITileNotificationFactory, 65536, Windows.Foundation.UniversalApiContract)]
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.MTA)]
class TileNotification final
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.MTA)]
/// [Windows.Foundation.Metadata.Activatable(Windows.UI.Notifications.ITileNotificationFactory, 65536, "Windows.Foundation.UniversalApiContract")]
class TileNotification final
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.MTA)]
/// [Windows.Foundation.Metadata.Activatable(Windows.UI.Notifications.ITileNotificationFactory, 65536, "Windows.Foundation.UniversalApiContract")]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
class TileNotification final
[Windows.Foundation.Metadata.Activatable(typeof(Windows.UI.Notifications.ITileNotificationFactory), 65536, typeof(Windows.Foundation.UniversalApiContract))]
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.MTA)]
public sealed class TileNotification
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.MTA)]
[Windows.Foundation.Metadata.Activatable(typeof(Windows.UI.Notifications.ITileNotificationFactory), 65536, "Windows.Foundation.UniversalApiContract")]
public sealed class TileNotification
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.MTA)]
[Windows.Foundation.Metadata.Activatable(typeof(Windows.UI.Notifications.ITileNotificationFactory), 65536, "Windows.Foundation.UniversalApiContract")]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
public sealed class TileNotification
function TileNotification(content)
Public NotInheritable Class TileNotification
Inheritance
Object Platform::Object IInspectable TileNotification
Attributes

Windows requirements

Device family
Windows 10 (introduced in 10.0.10240.0 - for Xbox, see UWP features that aren't yet supported on Xbox)
API contract
Windows.Foundation.UniversalApiContract (introduced in v1.0)

Examples

The following example uses the TileNotification constructor to create a new instance, then uses the ExpirationTime property to show a tile notification for 30 seconds.

```csharp
var Notifications = TileUpdateManager;
var currentTime = DateTime.Now;
var seconds = 30;

var tileXml = TileUpdateManager.GetTemplateContent(TileTemplateType.TileWide310x150Text04);
var tileTextAttributes = tileXml.GetElementsByTagName("text");
tileTextAttributes[0].AppendChild(tileXml.CreateTextNode("This notification will expire at " + currentTime.AddSeconds(seconds).ToLocalTime().ToString()));

var tileNotification = new TileNotification(tileXml);
tileNotification.ExpirationTime = currentTime.AddSeconds(seconds);
TileUpdateManager.CreateTileUpdaterForApplication().Update(tileNotification);
```

Constructors

TileNotification(XmlDocument)

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

Properties

Content

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

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.

Tag

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

Applies to

See also