How to create Secondary tiles on Windows phone start screen using c#

This is the third blog post of this series in which I am going to explain you how to create a secondary tile on Windows phone start screen.

 

Before going ahead I would like to give you a short summary on Secondary tiles.

 

What are Secondary tiles?

A secondary Tile is created programmatically by an application based on interaction from the user. Typical uses for a secondary Tile include scenarios where you want to show important information to the user on the Start screen of the phone.

 

1. First of all create a new project having the name Secondarytiles.

 


 

2. Then create a new image folder having the name Images in your project and add some sample images to it.

 


 

3. We shall be using Create(Uri, ShellTileData) method to create a Tiles on Start Screen. Whenever this method will be called the UI will navigate to Start Screen.

 

The different parameters in the above method are

1. Uri – It is the Uri of any page within the application where the application will navigate to whenever user taps on this tile from start screen. It should be unique for each secondary tile. By unique uri we mean that more than one tile can navigate to the same page but each should have different tag in the uri which will be explained in the further post.

2. ShellTileData– This data class is used to provide different properties to the tiles created through this method. It can be of different types.

 

Note: One property of the Secondary tiles which are created through the above method is that each should have a unique uri.

 

So if we try to create more than one secondary tile having the same uri. It will give an exception and will lead to crash. So as to avoid the following situation we use the following method checktile given below to check whether any tile with same uri exist before or not on start screen.

 

 

As there are three different tile templates in Windows phone 8/8.1. We will be discussing an example of each of the types.

 
http://www.windowsapptutorials.com/windows-phone/different-tile-templates-properties-windows-phone
 


 

Flip tile

For creating a flip tile on start screen we shall be using FlipTileData class as discussed in our previous post.

Create a button on the MainPage to pin the tile. The code for click event handler of the button is given below.

 

 

Output Images:

 

Front


Back


 

Cyclic tile

For creating a cyclic tile on start screen we shall be using CyclicTileData class as discussed in our previous post.

Create a button on the MainPage to pin the tile. The code for click event handler of the button is given below.

 

 

Output Images:

 

Medium


Wide


 

Iconic tile

For creating an iconic tile on start screen we shall be using IconicTileData class as discussed in our previous post.

Create a button on the MainPage to pin the tile. The code for click event handler of the button is given below.

 

 

Output Images:

 

Medium


Wide


 

As a developer I would like you to experiment with the different tile templates to get a better understanding of tiles.

 

I hope this post will be helpful to you. If you have any doubts related to this post you can download the full project from link from the link given below.

 
Download full project source Secondarytiles.zip
 

In the next blog post of this series I will explain you how to update and delete secondary tiles pinned on start screen.

 
Introduction to tiles in Windows phone app
Different tile templates and their properties in Windows phone
How to update and delete Secondary tiles on Windows phone start screen using c#

Different tile templates and their properties in Windows phone

This is the second blog post of this series in which I am going to tell you about different tile templates and their properties in windows phone application.

In case you have missed the last post you can refer to the following link given below

 
http://www.windowsapptutorials.com/windows-phone/introduction-to-tiles-in-windows-phone-app
 

Different tile templates are

1. Flip Tile Template

2. Cyclic Tile Template

3. Iconic Tile Template

 

First of all I shall be starting up with one of my favorite Flip tile template that is mostly used by developers for creating secondary tiles on start screen.

 

Flip Tile Template

The following image given below shows the property name associated with each aspect of the Tile template.


Tile Size info

Small tile Medium tile Wide tile
159*159 pixels 336*336 pixels 691*336 pixels

 

Creating a tile class

We can use the FlipTileData class to create or update any of the following properties of the tile.

The following code example shows how to create or update a flip Tile class using C# code

 

 

We will be showing the implementation of the following code in the next post of this series.

Note: You can also leave any of the following properties undefined. By default it will take values from the system.

 

Cyclic Tile Template

The following image given below shows the property name associated with each aspect of the Tile template.


 

Tile Size info

Small tile Medium tile Wide tile
159*159 pixels 336*336 pixels 691*336 pixels

 

Creating a tile class

We can use the CycleTileData class to create or update any of the following properties of the tile.

The following code example shows how to create or update a Cyclic Tile class using C# code

 

 

Note: You can specify minimum 1 and maximum 9 local image URLs not more that.

 

Iconic Tile Template

The following image given below shows the property name associated with each aspect of the Tile template.


 

Tile Size info

Small tile Medium tile Wide tile
159*159 pixels 336*336 pixels 691*336 pixels

 

Creating a tile class

We can use the IconicTileData class to create or update any of the following properties of the tile.

The following code example shows how to create or update a Icon Tile class using C# code

 

 

In my next post of this series I will explain you how to create secondary tiles on start screen using the above three tile templates.

 

Introduction to tiles in Windows phone app
How to create Secondary tiles on Windows phone start screen using c#
How to update and delete Secondary tiles on Windows phone start screen using c#