MANGO live tile: use a picture in the IsolatedStorage as a background for your tile

, , 1 Comment

One 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:

[code language=”csharp”]//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);[/code]

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 time and Wilfried   to figure this out, I hope this post will save you the search !

 

One Response

  1. produce grower

    18/12/2012 13 h 57 min

    Good blog with full of handy information about the MANGO live tile…!! I am so pleased to get this allocation in this website at all. A big thank for posting this valuable information in this website at all.

Comments are closed.