TileUpdateManager TileUpdateManager TileUpdateManager TileUpdateManager Class

Definition

Creates TileUpdater objects used to change and update Start menu tiles. This class also provides access to the XML content of the system-provided tile templates so that you can customize that content for use in updating your tiles.

public static class TileUpdateManagerpublic static class TileUpdateManagerPublic Static Class TileUpdateManagerpublic static class TileUpdateManager
Attributes
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Remarks

This is a static factory class and requires no instantiation.

Examples

The following example shows GetTemplateContent(TileTemplateType) used to retrieve the XML content of a tile template and CreateTileUpdaterForApplication() to send the notification to the app's tile.


function sendTileTextNotification() {
    var Notifications = Windows.UI.Notifications;

    // Get an XML DOM version of a specific template by using getTemplateContent.
    var tileXml = Notifications.TileUpdateManager.getTemplateContent(Notifications.TileTemplateType.tileWide310x150Text03);

    // You will need to look at the template documentation to know how many text fields a particular template has.
    // Get the text attribute for this template and fill it in.
    var tileAttributes = tileXml.getElementsByTagName("text");
    tileAttributes[0].appendChild(tileXml.createTextNode("Hello World!"));

    // Create the notification from the XML.
    var tileNotification = new Notifications.TileNotification(tileXml);

    // Send the notification to the calling app's tile.
    Notifications.TileUpdateManager.createTileUpdaterForApplication().update(tileNotification);
}

Methods

CreateTileUpdaterForApplication() CreateTileUpdaterForApplication() CreateTileUpdaterForApplication() CreateTileUpdaterForApplication()

Creates and initializes a new instance of the TileUpdater, which lets you change the appearance of the calling app's tile.

public static TileUpdater CreateTileUpdaterForApplication()public static TileUpdater CreateTileUpdaterForApplication()Public Static Function CreateTileUpdaterForApplication() As TileUpdaterpublic static TileUpdater CreateTileUpdaterForApplication()
Returns

The object you will use to send changes to the app's tile.

Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

CreateTileUpdaterForApplication(String) CreateTileUpdaterForApplication(String) CreateTileUpdaterForApplication(String) CreateTileUpdaterForApplication(String)

Creates and initializes a new instance of the TileUpdater for a tile that belongs to another app in the same package as the calling app. The TileUpdater lets a developer change the appearance of that tile.

public static TileUpdater CreateTileUpdaterForApplication(String applicationId)public static TileUpdater CreateTileUpdaterForApplication(String applicationId)Public Static Function CreateTileUpdaterForApplication(applicationId As String) As TileUpdaterpublic static TileUpdater CreateTileUpdaterForApplication(String applicationId)
Parameters
applicationId
System.String System.String System.String System.String

The Package Relative Application ID (PRAID) of the tile.

Returns

The object you will use to send changes to the tile identified by applicationId.

Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Remarks

This method is used only in conjunction with multi-app packages. The app identified by applicationId must belong to the same package as the caller.

Although you can specify the calling application's tile in this method, CreateTileUpdaterForApplication() is the preferred method to use with single-app packages.

CreateTileUpdaterForSecondaryTile(String) CreateTileUpdaterForSecondaryTile(String) CreateTileUpdaterForSecondaryTile(String) CreateTileUpdaterForSecondaryTile(String)

Creates and initializes a new instance of the TileUpdater, which enables you to change the appearance of a SecondaryTile. The tile can belong to the calling app or any other app in the same package.

public static TileUpdater CreateTileUpdaterForSecondaryTile(String tileId)public static TileUpdater CreateTileUpdaterForSecondaryTile(String tileId)Public Static Function CreateTileUpdaterForSecondaryTile(tileId As String) As TileUpdaterpublic static TileUpdater CreateTileUpdaterForSecondaryTile(String tileId)
Parameters
tileId
System.String System.String System.String System.String

A unique ID for the tile.

Returns

The object you will use to send updates to the tile identified by tileID.

Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Remarks

Examples

The following example demonstrates how to send a notification to a secondary tile.


var Notifications = Windows.UI.Notifications;

// Define the notification content.
var tileXml = Notifications.TileUpdateManager.getTemplateContent(Notifications.TileTemplateType.tileWide310x150Text04);
var tileTextAttributes = tileXml.getElementsByTagName("text");
tileTextAttributes[0].appendChild(tileXml.createTextNode("Sent to a secondary tile!"));

// Provide a medium version of the notification as well, remembering that the user has control 
// over whether the tile is displaying as wide or square.
var squareTileXml = Notifications.TileUpdateManager.getTemplateContent(Notifications.TileTemplateType.tileSquare150x150Text04);
var squareTileTextAttributes = squareTileXml.getElementsByTagName("text");
squareTileTextAttributes[0].appendChild(squareTileXml.createTextNode("Sent to a secondary tile!"));

// Add the medium tile to the notification.
var node = tileXml.importNode(squareTileXml.getElementsByTagName("binding").item(0), true);
tileXml.getElementsByTagName("visual").item(0).appendChild(node);

// Create the notification based on the XML content.
var tileNotification = new Notifications.TileNotification(tileXml);

// Create a secondary tile updater and pass it the secondary tileId
var tileUpdater = Notifications.TileUpdateManager.createTileUpdaterForSecondaryTile("SecondaryTile.Dynamic");

// Send the notification to the secondary tile.
tileUpdater.update(tileNotification);

GetForUser(User) GetForUser(User) GetForUser(User) GetForUser(User)

Creates and initializes a new TileUpdateManagerForUser for the specified user, which lets you change the appearance or content of a tile for a specific user.

public static TileUpdateManagerForUser GetForUser(User user)public static TileUpdateManagerForUser GetForUser(User user)Public Static Function GetForUser(user As User) As TileUpdateManagerForUserpublic static TileUpdateManagerForUser GetForUser(User user)
Parameters
user
User User User User

The user who will recieve the tile updates.

Returns
Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

GetTemplateContent(TileTemplateType) GetTemplateContent(TileTemplateType) GetTemplateContent(TileTemplateType) GetTemplateContent(TileTemplateType)

Gets the XML content of one of the predefined tile templates so that you can customize it for a tile update.

Note

When this method is called on a Windows 8 system, it returns a version 1 template. When this method is called on a Windows 8.1 system, it returns a version 2 template. However, if an app specifies Windows 8 compatibility in its manifest, this method returns a version 1 template.

public static XmlDocument GetTemplateContent(TileTemplateType type)public static XmlDocument GetTemplateContent(TileTemplateType type)Public Static Function GetTemplateContent(type As TileTemplateType) As XmlDocumentpublic static XmlDocument GetTemplateContent(TileTemplateType type)
Parameters
Returns

The object that contains the XML.

Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Remarks

You can use Document Object Model (DOM) manipulation functions to customize the template content for use in a TileNotification update that you will send to the tile through the TileUpdater that you create through the other methods of this class.

See tile schema for an explanation of tile elements and attributes.

Examples

The following example shows GetTemplateContent(TileTemplateType) used to retrieve the XML content of a tile template.



var tileTemplate = Windows.UI.Notifications.TileTemplateType.tileWide310x150Text03;
var tileXml = Windows.UI.Notifications.TileUpdateManager.getTemplateContent(tileTemplate);