Continuing my series of Blog posts that distill the presentations I’m giving this month in Europe and the UK, today I’ll take a look at creating a Live Tile.
Live tiles tell the user that something interesting is happening in your application, or that you have new information for them.
Live tiles are an essential and exciting part of Windows 8 and creating a Live tile is not very difficult. In fact, creating a simple Life tile is, well, simple.
To start, create a new blank application and name it LiveTile. The very first thing to do is to add the NotificationsExtensions project that Microsoft are* shipping with the SDK and with the Sample applications on tiles.
*I’m in the UK right now, and here corporations are plural(!)
On the home page, create a button,
When the button is clicked, we’re going to send text to the tile.
Note that there are two ways to send text to a tile:
- From within the application as we are doing here
- Using the Windows Notification Service (NWS) covered in a future blog post
In the event handler for the button click event, we start by creating a wide and a square tile with the new text we want to display,
We then attach the square tile to the wide tile,
Create an instance of TileNotification by calling CreateNotification on the wide tile,
Create an instance of TileUpdater by calling CreateTileUpdaterForApplication on the TileUpdateManager,
Pass the notification to the Update method of the TileUpdater,
That’s all there is to it. If you switch to your tile in the start menu, you’ll see the message pop into view.
You can find the source for this example here