Reputation: 147
I'm looking to create an app that has a secondary tile that when pressed, runs some code and then exits out to the start screen, much like 'Stop The Music!' where you can pin a quick-stop tile to tap and instantly stop any audio media playing. I am certain this works on WP8 applications as the feature works perfectly on my Lumia 820 however I am unsure if there is a way to do it for WP7 and I am also struggling to find any tutorials/papers explaining how it works or how to do it.
The tile won't be a live tile feeding back information but rather a short cut to a feature in the app, can anyone point me towards a clear explanation/tutorial or explain themselves please?
Upvotes: 0
Views: 305
Reputation: 28737
You could use the following code:
StandardTileData tileData = new StandardTileData
{
Title = "Secondary Tile",
BackgroundImage = new Uri("/image.png", UriKind.Relative),
Count = 5,
BackTitle = "Secondary Tile",
BackBackgroundImage = new Uri("", UriKind.Relative),
BackContent = "Secondary tile sample"
};
// having a unique NavigationUri is necessary for distinguishing this tile
string tileUri = "/MainPage.xaml?id=1";
ShellTile.Create(new Uri(tileUri, UriKind.Relative), tileData);
Note that you can only create a secondary tile in reaction to a user event.
Upvotes: 2