locked
Setting a tile image with a BitmapImage RRS feed

  • Question

  • Hi,

    I'm trying to create an dynamic tile for my application.  I'm using TileTemplateType.TileWideSmallImageAndText03 but I want to set the image to the contents of a BitmapImage that I have loaded.  I'm not even sure if this is possible because of the nature of metro tiles but I thought it was worth asking the question.

    Here's a section of code similar to what I'm using:

    BitmapImage Thumb = [Create Image Here]
    
    var ThisTile = TileUpdateManager.GetTemplateContent(TileTemplateType.TileWideSmallImageAndText03);
    var tileAttributes = ThisTile.GetElementsByTagName("text");
    tileAttributes[0].AppendChild(ThisTile.CreateTextNode(TileText));
    tileAttributes = ThisTile.GetElementsByTagName("image");
    ((XmlElement)tileAttributes[0]).SetAttribute("src", Thumb); // <-- How do I do this?

    Saturday, June 22, 2013 4:07 PM

Answers

  • You should use ms-appx:// protocol for installed location and ms-appdata:// protocol for local data folder.

    For example if you have wide tile in Assets/wide-tile.png you should use ms-appx://Assets/wide-tile.png

    • Proposed as answer by Dave SmitsMVP Sunday, June 23, 2013 11:19 AM
    • Marked as answer by Silverdex Sunday, June 23, 2013 11:34 AM
    Sunday, June 23, 2013 8:54 AM

All replies

  • You should use ms-appx:// protocol for installed location and ms-appdata:// protocol for local data folder.

    For example if you have wide tile in Assets/wide-tile.png you should use ms-appx://Assets/wide-tile.png

    • Proposed as answer by Dave SmitsMVP Sunday, June 23, 2013 11:19 AM
    • Marked as answer by Silverdex Sunday, June 23, 2013 11:34 AM
    Sunday, June 23, 2013 8:54 AM
  • and when using live tiles it can also be an  http url

    Microsoft Certified Solutions Developer - Windows Store Apps Using C#

    Sunday, June 23, 2013 11:20 AM
  • Thanks guys,

    I did wonder if the answer might be something like.  I guess I'll need to re-think the look of my live tile.

    Chris.

    Sunday, June 23, 2013 11:36 AM