Working with LiveTiles in Metro Applications

Live Tiles are not new from Microsoft. We already have Live Tiles introduced in Windows Mobile 7 interfaces. Live tiles in Metro applications work more or less similar to what has been there in WP7. When you open Windows 8 Tablet, you will see a number of Tiles that hold up the entire screen, which are multi touch sensitive and also easily customization with hand. These tiles not only important to launch the application, but you can also register a handler to update the tiles from within your code.

To do, we consider three classes mainly.

1. TileUpdateManager : Manages the Tile Updater, can get you TileUpdater for the current application.
For instance

var tileUpdater = TileUpdateManager.CreateTileUpdaterForApplication();

This will get the current application TileUpdater.

2. TileUpdater : This object lets you update tiles with notifications.
3. TileNotification : Prepresents an update block for a tile.

Lets add a simple TileUpdater :

private void Button_Click(object sender, RoutedEventArgs e)
TileUpdater updater = TileUpdateManager.CreateTileUpdaterForApplication();


private void SendNotification()
var tile = TileUpdateManager.GetTemplateContent(TileTemplateType.TileWideText03);
var attr= tile.GetElementsByTagName("text");

var tilenotification = new TileNotification(tile);


Here the Templte represents an XML object that happens to be forming the UI. Generally if you use Javascript it would be lot easier to handle this, but for C#, you need to create a TextNode in the xml and send it using the TileUpdater. The TileUpdater then notify the Live tile to update with the data.

Here when the button is clicked it updates the live tile to show current DateTime.

I hope this post comes handy. You can also read my other articles like
Understanding basic WinRT Metro Applications and Application Capabilities
Layout adjustments Snapping and OrientationChanges in Metro Applications

I hope these comes to you handy.

Thank you for reading.

Abhishek Sur

Abhishek Sur is a Microsoft MVP since year 2011. He is an architect in the .NET platform. He has profound theoretical insight and years of hands on experience in different .NET products and languages. He leads the Microsoft User Group in Kolkata named KolkataGeeks, and regularly organizes events and seminars in various places for spreading .NET awareness. He is associated with the Microsoft Insider list on WPF and C#, and is in constant touch with product group teams. He blogs at His Book : Visual Studio 2012 and .NET 4.5 Expert Development Cookbook. Follow Abhishek at Twitter : @abhi2434