MANGO live tile: use a picture in the IsolatedStorage as a background for your tile
3 August 2011One on the nice feature coming with WP7's mango is "live tiles". You can create tiles directly from your application and update them from a background agent.
Here is the sample which creates a "secondary tile" for your application:
//This is a .Net class named StandardTileData var theTile= new StandardTileData { Title = "Secondary Tile", //The title BackgroundImage = new Uri("FrontImage.jpg", UriKind.Relative), Count = 12, //Notification number BackTitle = "Back's page title", //The title of the back page BackContent = "A text is nice here", BackBackgroundImage = new Uri("backImage.jpg", UriKind.Relative) }; // Add the live tile to the Home screen (will exit the app) ShellTile.Create(new Uri("/MainPage.xaml", UriKind.Relative), theTile);
Now, you may want to generate a screenshot of your application (using WriteableBitmap) and use it as the tile background. This is possible !
To do so, you have to store the picture in a folder named "Shared/ShellContent" otherwise you will have an NotSupportedException throwned.
The URI to use will then look like this one : "isostore:/Shared/ShellContent/background.png". You can read this MSDN page for more information.
It takes me some minutes and Wilfried to figure this out, I hope this will save you this time !