locked
How to add multiple images/texts to a secondary tile RRS feed

  • Question

  • Hello all,

    Is it possible to add multiple images/texts to one secondary tile? I want to rotate those images/texts for one secondary tile... here is my code... Can I add multiple template to one secondary tile? Thanks in advance.. 

     XmlDocument largeTileData = TileUpdateManager.GetTemplateContent(TileTemplateType.TileWideImageAndText01);
                XmlNodeList largeTextData = largeTileData.GetElementsByTagName("text");
                XmlNodeList imageData = largeTileData.GetElementsByTagName("image");
                largeTextData[0].InnerText = messageHeader;
               // largeTextData[1].InnerText = messageContent;
                ((XmlElement)imageData[0]).SetAttribute("src", "test.jpg");

                //Create a Small Tile notification also (not required, but recommended.)
                XmlDocument smallTileData = TileUpdateManager.GetTemplateContent(TileTemplateType.TileSquarePeekImageAndText02);
                XmlNodeList smallTileText = smallTileData.GetElementsByTagName("text");
                XmlNodeList smallTileImage = smallTileData.GetElementsByTagName("image");
                smallTileText[0].InnerText = messageHeader;
                smallTileText[1].InnerText = messageContent;
                ((XmlElement)smallTileImage[0]).SetAttribute("src", "ms-appx:///test1.jpg");

                //Merge the two updates into one <visual> XML node
                IXmlNode newNode = largeTileData.ImportNode(smallTileData.GetElementsByTagName("binding").Item(0), true);
                largeTileData.GetElementsByTagName("visual").Item(0).AppendChild(newNode);          

                //Create the notification the same way.
                TileNotification notification = new TileNotification(largeTileData);
                TileUpdateManager.CreateTileUpdaterForSecondaryTile(tileId).Update(notification);

     
    Sunday, June 23, 2013 6:08 PM

Answers

  • Yes you can send multiple tile update notifications using multiple templates at the same time. But only latest 5 will be retained per tile type. For this you need to enable notification Queue

    var tileUpdater = TileUpdateManager.CreateTileUpdaterForSecondaryTile(tileId);
    
    tileUpdater.Clear();
    //This is needed to send multiple notifications
    tileUpdater.EnableNotificationQueue(true);


    -- Vishal Kaushik --

    Please 'Mark as Answer' if my post answers your question and 'Vote as Helpful' if it helps you. Happy Coding!!!

    Monday, June 24, 2013 7:52 PM

All replies

  • Yes you can send multiple tile update notifications using multiple templates at the same time. But only latest 5 will be retained per tile type. For this you need to enable notification Queue

    var tileUpdater = TileUpdateManager.CreateTileUpdaterForSecondaryTile(tileId);
    
    tileUpdater.Clear();
    //This is needed to send multiple notifications
    tileUpdater.EnableNotificationQueue(true);


    -- Vishal Kaushik --

    Please 'Mark as Answer' if my post answers your question and 'Vote as Helpful' if it helps you. Happy Coding!!!

    Monday, June 24, 2013 7:52 PM
  • thank you Vishal,

    but then where to add those templates? Do you have any sample? plz

    Sunday, June 30, 2013 10:11 PM
  • If you go to the top of the page and click on "Samples" you can search the sample gallery.

    This is demonstrated in the App tiles and badges sample (Windows 8) and discussed with quickstarts and code snippets in the Creating tiles and badges documentation.

    --Rob

    Sunday, June 30, 2013 10:35 PM
    Moderator