3
votes

I created an app that has my own custom live tile in it.
There are three size of live tile user controls created but added here is only one size(see codes) and I need to add the same for other two sizes(Medium and Small tile).

Here's the source - Custom Live Tile

Below is the code for the Wide Tile...

Dispatcher.BeginInvoke(() =>
   {
       // Render the new tile image
       RenderImageLibrary.WideTileControl wtc = 
            new RenderImageLibrary.WideTileControl(tempMain, descr, loc);
       wtc.SaveJpegComplete += async (s, args) =>
       {
           try
           {
              if (args.Success)
              {
                 // Set the tile image URI - "isostore:/" is important! Note that the control already
                 // puts the image into /Shared/ShellContent which is where tile images in the local folder must be
                 Uri tileImageUri = new Uri("isostore:/" + args.ImageFileName, UriKind.RelativeOrAbsolute);
                 Debug.WriteLine(tileImageUri.ToString());

                 // Set the tile image
                 FlipTileData ftd = new FlipTileData();
                 ftd.WideBackgroundImage = tileImageUri;

                 ShellTile.ActiveTiles.First().Update(ftd);
              }
              else
              {
                 Debug.WriteLine(args.Exception.ToString());
              }
           }
           catch (Exception ex)
           {
              Debug.WriteLine(ex.ToString());
           }
       };
       wtc.BeginSaveJpeg();
   });
1

1 Answers

2
votes

You can use

ftd.BackgroundImage = tileImageUri; ftd.SmallBackgroundImage = tileImageUri;

For more information on FlipTileData you can refer to http://msdn.microsoft.com/en-us/library/windowsphone/develop/microsoft.phone.shell.fliptiledata