In this article we are going to see what a Pivot Control in the application development for Windows Phone 8. Pivot control are available right from the initial version of Windows Phone which is mostly used in a large phase of the application development, like say for example if we need to split the data in a much easier way to make it user friendly to read by the end user then Pivot Control plays a major role.
Pivot control provides your application a nice look with the different views or say pages to manage the data and show to the large dataset as multiple views of data in the same screen by simply providing option to flick between the views horizontally. Pivot control comes with an inbuilt support for touch interaction and navigation where we can simply implement the functionality in the application.
Pivot control is the base control for Pivot application and it has two different layers with each layer contained inside a Grid control that will act as the root layout for the control. The two layers are Header list and the Pivot Item, as the name suggest the Header list is basically to show up the header details mostly the title of the application or the page which shows up in all the views. Next is the Pivot Item which is basically used to display the content with in an individual page for the data to be viewed as a standard page element.
Let us see the step by step approach on how to use this control in a Windows Phone 8 application development. We have a new template that is available for this Pivot control usage which can be seen in the Visual Studio 2012 IDE template listing.
Open Visual Studio 2012 IDE in administrator mode and select a new Project and browse through the Windows Phone template and select Windows Phone Pivot App as shown in the screen below.
Now we can see the project created with a list of default files and folders that are basically required to run the application as shown in the screen below. By using this template we have some default application data that will also be loaded on to the application. If required we can delete the data and use our own data to use it across the application. If we need to use the Pivot control in a normal application without these predefined data then we can use the Blank template and add the Pivot control.
Let us change some of the default data to handle our requirement like changing the application title, Header names etc in the XAML code so that we can understand on how it takes effect by changing the code directly in the designer as shown in the screen below.
Now build and execute the application by simple pressing F5 key from the keyboard and we can see Visual Studio will build the application and open the Emulator to display the output as shown in the screen below.
So in this article we have seen how to use the Pivot control with the inbuilt available template with Visual Studio 2012 IDE.