【问题标题】:How to Populate a Windows 8.1 live tile?如何填充 Windows 8.1 动态磁贴?
【发布时间】:2014-06-05 20:39:18
【问题描述】:

我正在关注http://msdn.microsoft.com/en-us/library/windows/apps/hh465429.aspx 此处的文档,并且我已经成功地为我的应用创建了一个动态磁贴。

但是文档没有说明如何使用内容填充动态磁贴,我不确定如何执行此操作。我的代码在这里

Windows.UI.Notifications.TileUpdateManager.createTileUpdaterForApplication().enableNotificationQueue(true);

var template = Windows.UI.Notifications.TileTemplateType.tileWide310x150Text04;

var tileXml = Windows.UI.Notifications.TileUpdateManager.getTemplateContent(template);

// TO DO: Fill in the template with your tile content. Define a tile and add it to tileXML.

var tileNotification = new Windows.UI.Notifications.TileNotification(tileXml);

Windows.UI.Notifications.TileUpdateManager.createTileUpdaterForApplication().update(tileNotification);

【问题讨论】:

  • 你有没有看到this doc 以及关于 tile xml 的讨论
  • @ShawnKendrot 谢谢,成功了

标签: javascript windows windows-8 windows-phone live-tile


【解决方案1】:

Sending a tile update 文档将引导您完成向磁贴添加内容的过程。 像上面那样调用getTileContent后,你可以像这样更新xml

var tileTextAttributes = tileXml.getElementsByTagName("text");
tileTextAttributes[0].appendChild(tileXml.createTextNode("Hello World! My very own tile notification"));

该文档中有更多示例

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-09-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多