Tiles in Windows Phone Mango – Create and Delete Secondary Tile

This is the 4th part of my series on the Tiles in Windows Phone Mango .

In this Blog post , i will explain how one can create Secondary Tiles in Windows Phone .

The Secondary Tile is generally created from the App programatically based on the users interaction .

A simple scenario where the secondary tiles can be used are the Weather Application or a Chat Application .

The Weather Appllication might provide the user with the option of pinning only the selected locations to the start screen of the Windows Phone 7 .

The Chat Application might allow the user to pin a user to the start screen .

So , how do we create the Secondary Tile in Windows Phone ? .

We can again use the StandardTileData Class to define the properties of the Tile and use the Create Method of the Shell Tile to create the secondary Tile .

The below sample sourcecode should create one .

/// <summary>
/// Creates the secondary tile.
/// </summary>
public void CreateSecondaryTile()
   StandardTileData TileInfo = new StandardTileData
     BackgroundImage = null,
     Title = "iSenthil",
     Count = 26,
     BackTitle = "Ginktage",
     BackContent = "My Secondary Tile Sample",
     BackBackgroundImage = null
   ShellTile.Create(new Uri("/Page1.xaml?Place=Bangalore", UriKind.Relative), TileInfo);

There is an issue with the above one … When you try to call the above more than once , you will get the following error


We should create the Tile only if it is not found . So , its necessary to validate and check if the Tile Exists .

This can be done by verifying the Tile Name “Place=Bangalore” in ShellTile.ActiveTiles.FirstOrDefault() and check with the NavigationUri if the name exists .

You can delete the secondary Tile by finding the tile from the ActiveTiles and calling the Delete method of the found ShellTile

/// <summary>
/// Deletes the tile.
/// </summary>
private void DeleteTile()
   ShellTile TileToDelete = ShellTile.ActiveTiles.FirstOrDefault(x => x.NavigationUri.ToString().Contains("Place=Bangalore"));
   if (TileToDelete != null)


To Update , you can use the Update Method of the ShellTile like the one that was described in my previous post on Application Tile .

via WindowsPhoneRocks.com


0 thoughts on “Tiles in Windows Phone Mango – Create and Delete Secondary Tile

  1. Pingback: Interesting .NET Links - October 19 , 2011 | Tech Blog

Leave a Reply

Your email address will not be published. Required fields are marked *