共用方式為


TileUpdateManager.CreateTileUpdaterForSecondaryTile(String) 方法

定義

建立並初始化 TileUpdater的新實例,可讓您變更 次要磚的外觀。 圖格可以屬於呼叫的應用程式或任何其他相同套件中的應用程式。

public:
 static TileUpdater ^ CreateTileUpdaterForSecondaryTile(Platform::String ^ tileId);
 static TileUpdater CreateTileUpdaterForSecondaryTile(winrt::hstring const& tileId);
public static TileUpdater CreateTileUpdaterForSecondaryTile(string tileId);
function createTileUpdaterForSecondaryTile(tileId)
Public Shared Function CreateTileUpdaterForSecondaryTile (tileId As String) As TileUpdater

參數

tileId
String

Platform::String

winrt::hstring

磚的唯一識別碼。

傳回

您將用來將更新傳送至 tileID所識別磚的物件。

範例

下列範例示範如何將通知傳送至次要磚。

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);

適用於

另請參閱