feature1

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#

Chetan Gulati

Currently am doing B TECH in IT from Delhi Technological University. App development is my passion. Believe in quality rather than quantity.

Read more:
How to create your first Windows Phone app
How to change the App name and Tile name of your Windows phone app
Data binding in Windows Phone app – One way binding
Close