Create a simple Live Tile

One of the most striking features of the new MS Windows Phone OS are Live Tiles. Customizing your application tile is the argument of this post.

In a few lines of code we can build our custom tile.

The idea is to show, in the back content, the last inserted measure in the application. The application is Pressure Diary, shown in Windows Phone Applications page

public void CreateApplicationTile()
        {
            var appTile = ShellTile.ActiveTiles.First();

            if (appTile != null)
            {
                var standardTile = new StandardTileData
                {
                    Title = App.ApplicationName,
                    BackgroundImage = new Uri("Images/Tile_173x173.png", UriKind.Relative),
                    Count = null, // any number can go here, leaving this null shows NO number
                    BackTitle = App.ApplicationName,
                    BackContent = "Last measure: " + "[" + this.globalMeasure.Systolic.ToString() + "/" + this.globalMeasure.Diastolic.ToString() + "]" + this.globalMeasure.Date.Value.ToShortDateString()
                };

                appTile.Update(standardTile);
            }
        }

You can use these line of code to build your custom tile.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s