Implementing Live Tiles – Old

In Windows Store Apps by hfarazm1 Comment

Goto NEW Version of this post HERE

Live tiles in windows 8.1 is ANIMATING tile i.e after some time content of app TILE (Not inside app but on start screen tile) changes automatically.

Lets do it now!

1. Open visual studio 13 > New project > Visual C# > Blank App

2. In solution explorer, open MainPage.Xaml and add a button.
3. Add below lines of code to button event(right clicking button code and select view definition) in csharp file.

string tileXmlString = " <tile >"
                + " <visual version='2' >"
                + " <binding template='TileSquare150x150Image' fallback='TileSquareImage' >"
                + " <image id='1' src='ms-appx:///images/graySquare150x150.png' alt='Gray image'/ >"
                + " </binding >"
                + " <binding template='TileWide310x150ImageAndText01' fallback='TileWideImageAndText01' >"
                + " <image id='1' src='ms-appx:///images/New Tile.png' alt='Green'/ >"
                + " <text id='1' >Microsoft Innovation Center </text >"
                + " </binding >"
                + " <binding template='TileSquare310x310Image' >"
                + " <image id='1' src='ms-appx:///images/purpleSquare310x310.png' alt='Purple image'/ >"
                + " </binding >"
                + " </visual >"
                + " </tile >";

            // Create a DOM.
            Windows.Data.Xml.Dom.XmlDocument tileDOM = new Windows.Data.Xml.Dom.XmlDocument();

            // Load the xml string into the DOM.
            tileDOM.LoadXml(tileXmlString);

            // Create a tile notification.
            TileNotification tile = new TileNotification(tileDOM);

            // Send the notification to the application’s tile.
            TileUpdateManager.CreateTileUpdaterForApplication().Update(tile);

4. Goto manifest file and do following steps in picture.
Live Tile

Download Complete code by Mr. Usman-Ur-Rehman
Having any problem implementing above code? Click on this post title and comment below there.