【问题标题】:Using Tiles templates windows8使用 Tiles 模板 windows8
【发布时间】:2012-10-15 14:24:46
【问题描述】:

我正在尝试使用图块模板(显示图像并切换显示文本的图块)

http://msdn.microsoft.com/en-us/library/windows/apps/hh761491.aspx#TileSquarePeekImageAndText04

问题是:我将这个 XML 放在哪里以及如何在 XAML 中调用它?

【问题讨论】:

标签: xaml windows-8 microsoft-metro tiles


【解决方案1】:

您不会在 XAML 中调用它,而是将其提供给 TileUpdater 实例,正如您可以从下面的 TileUpdateManager 文档中看到的那样。这个简单的场景处理local notification(但也有scheduledperiodicpush 可以利用的通知)。

查看App tiles and badgesPush and periodic notifications 示例以获得指导。

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

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-11-01
    • 1970-01-01
    • 2023-04-05
    • 1970-01-01
    相关资源
    最近更新 更多