Navigations on Windows Phone Part 2

Pivot

Pivot is designed to show a number of data and enable selections, and view items based on a certain category. Pivot is used to manage application views that have several layouts or pages with built-in navigations that support, such as:

1. Horizontal pan (press and drag left or right)

2. Horizontal flick (press and slide quickly left or right)

3. Navigation hosted controls

A sample of pivot implementation is the following figure:

PIVOT VIEW [6]

FIGURE 3 PIVOT VIEW [6]

Some best practices that can be put into account in developing application using Pivot controls are:

• Reduce the number of pages in Pivot control for performance reasons.

• Boost application performance by displaying data on-demand as opposed to loading all of them at once in the beginning.

• Make sure that each item displayed to users is of the same type.

• Pivot control should only be used if it suits the desired user experience.


Now let us learn how to use Pivot control in an application.

1. Create a new Windows Phone Pivot Application.

tmp1C-27

Note:

To continue from the previous exercise, right click on the project and select Add Windows Phone Pivot Page. Or if you want to add Pivot control on existing page, drag and drop from the toolbox to your page.

tmp1C-28

2. We will only use the template that is generated automatically while creating the application. Press F5 and see the results.

tmp1C-29_thumb[2]

3. Now let’s review the code in the main page. This is what it looks like:

tmp1C-30_thumb[2]

 

 

 

tmp1C-31_thumb[2]

Examine that it is basically similar to Panorama View’s schematics. In Pivot control there is one main container which includes several PivotItem. Pivotltem can be used as containers equal to other containers such as grid or canvas in which we can place other controls. 4. To add a new item, here is the example:

tmp1C-32_thumb[2]

Don’t forget to add the following reference in the class declaration:

tmp1C-33_thumb[2]

5. Press F5 for results.

tmp1C-34

Next post:

Previous post: