In my previous articles, I gave an overview of the Tiles in Windows Phone Mango.
In this article, i will explain how developers can use the ShellTile API to update the Application Tile.
Note the restriction on using the ShellTile API. This can be used to Update the Application Tile and cannot be used to Create or delete an Application Tile.
We should use the ShellTile.ActiveTiles.First () to get the access to the Tile of the Application .
This will always return the Application Tile even if the App is not pinned to the Start Screen.
We can then use the StandardTileData class to create the Data for the Tile and then use the Update Method of the “ShellTile” with the data.
To access the ShellTile , we should also use the namespace Microsoft.Phone.Shell in the code behind file .
using System; using System.Collections.Generic; using System.Linq; using System.Net; using System.Windows; using System.Windows.Controls; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Animation; using System.Windows.Shapes; using Microsoft.Phone.Controls; using Microsoft.Phone.Shell; namespace PhoneApp5 { public partial class MainPage : PhoneApplicationPage { // Constructor public MainPage() { InitializeComponent(); } private void PhoneApplicationPage_Loaded(object sender, RoutedEventArgs e) { UpdateApplicationTile(); } private void UpdateApplicationTile() { ShellTile ApplicationTile = ShellTile.ActiveTiles.First(); if (ApplicationTile != null) { // In this example , the default image will be used StandardTileData NewTileData = new StandardTileData { Title = "WP7 Rocks", BackgroundImage = null, Count = 99, BackTitle = "By Senthil", BackBackgroundImage = null, BackContent = "Twitter : @isenthil" }; // Updates the Application Tile ApplicationTile.Update(NewTileData); } } } }
via Tiles in Windows Phone Mango – Update an Application Tile using ShellTile APIs