【问题标题】:Show a generated image on Live Tile在动态磁贴上显示生成的图像
【发布时间】:2012-11-09 04:20:45
【问题描述】:

我在我的应用程序中创建了一个自定义图像(例如通过捕获墨迹数据),然后想要在 Live Tile 上显示生成的图像。我该怎么做?

【问题讨论】:

    标签: windows-8 microsoft-metro live-tile


    【解决方案1】:

    您需要做的就是将图像分配给动态磁贴模板。

    TileUpdateManager.GetTemplateContent(TileTemplateType.TileWideImageAndText01);
    
    XmlNodeList tileTextAttributes = tileXml.GetElementsByTagName("text");
    tileTextAttributes[0].InnerText = "Hello World! My very own tile notification";
    
    XmlNodeList tileImageAttributes = tileXml.GetElementsByTagName("image");
    ((XmlElement)tileImageAttributes[0]).SetAttribute("src", "ms-appx:///images/redWide.png");
    ((XmlElement)tileImageAttributes[0]).SetAttribute("alt", "red graphic");
    
    XmlDocument squareTileXml = TileUpdateManager.GetTemplateContent(TileTemplateType.TileSquareText04);
    XmlNodeList squareTileTextAttributes = squareTileXml.GetElementsByTagName("text");
    squareTileTextAttributes[0].AppendChild(squareTileXml.CreateTextNode("Hello World! My very own tile notification"));
    IXmlNode node = tileXml.ImportNode(squareTileXml.GetElementsByTagName("binding").Item(0), true);
    tileXml.GetElementsByTagName("visual").Item(0).AppendChild(node);
    
    TileNotification tileNotification = new TileNotification(tileXml);
    
    tileNotification.ExpirationTime = DateTimeOffset.UtcNow.AddSeconds(10);
    
    TileUpdateManager.CreateTileUpdaterForApplication().Update(tileNotification);
    

    【讨论】:

      【解决方案2】:

      以下 Jeff Blankenburg 的博文可以作为您想了解的有关动态磁贴的所有信息的起点:

      31 Days of Windows 8

      【讨论】:

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