Search code examples
c#windows-8windows-store-appswindows-8.1live-tile

Live tiles with 5 images in cycle


I know how to show a simple Live Tile in a Windows Store App. I used to charge an XmlTemplate string choosing certain width.

But, I've seen that there some apps that show like 5 different live tiles. By example, Photos app show 5 images in cycle and change each 5 seconds so so.

How can I perform this functionality in my app or if you can show an app demo from Windows 8.1 samples, I would be greatful with you.


Solution

  • Here is a msdn sample. But it's a bit cryptic for my taste.

    In simple steps, you should create 5 tiles (or less) and put them into notification queue. Enable queue and supply tileTagId.

    Here is my code: AllTiles - array with all the tiles. AppTileId - secondary tile Id. You can change it to the primary tile by uncommenting the line with CreateTileUpdaterForApplication code.

    // Posting update
    int tileTagId = 0;
    foreach ( XmlDocument XmlTile in AllTiles )
    {
        TileNotification tileNotification = new TileNotification( XmlTile );
        tileNotification.Tag = tileTagId.ToString();
        TileUpdater secondaryTileUpdater = TileUpdateManager.CreateTileUpdaterForSecondaryTile( AppTileId );
        //TileUpdater secondaryTileUpdater = TileUpdateManager.CreateTileUpdaterForApplication();
        secondaryTileUpdater.EnableNotificationQueue( true );
        secondaryTileUpdater.Update( tileNotification );
        tileTagId++;
    }