MBZ
MBZ

Reputation: 27632

Show a generated image on Live Tile

I create a custom image in my app (by capturing ink data for example) and then want to show the generated image on Live Tile. How can I do this?

Upvotes: 1

Views: 789

Answers (2)

pdriegen
pdriegen

Reputation: 2039

The following blog post by Jeff Blankenburg can be used as a starting point for everything you want to know about Live Tiles:

31 Days of Windows 8

Upvotes: 0

Mayank
Mayank

Reputation: 8852

all you need to do is assign the image to the live tile template.

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

Upvotes: 1

Related Questions