Its common knowledge that Windows Phone 7/WP7 platform runs Silverlight based applications. Unlike Silverlight, Windows Phone 7 uses additional user interface structure to facilitate a common user interface across applications. To make it easier for you to setup your app, Microsoft Visual Studio provides four different project templates plus a 5th for Class Libraries. Why four different project templates? The four templates are there to assist you in creating one of the common types of apps from a user interface perspective. Each of project templates is discussed below:
Windows Phone Application
The Windows Phone Application Template is the simplest and the closest to a blank slate. If you create a new project from this template you will be presented with a solution containing little more than the bare minimum necessary for the project. The page create for the app is simple, showing only the application name and a page name.
This template is useful primarily if you plan to create a free form application or you are not happy with the other templates below. Using this template, you can manually build data bound screens, panoramas, or pivots into your app.
Windows Phone Databound Application
Using the Windows Phone Databound Application template provides you with a solution containing quite a bit more functionality. This template is focused primarily at apps centered around data driven list/detail screens. This can be a very useful starting point when you are building something like an RSS reader where you show the items from the feed in the list and allow the user to drill down. You can also look at using the detail screen for edits to items in the list. The list screen created like before contains the application name and the page name. In addition the list is configured to show a two line per item in the list.
The detail page is again simple with the application name, page name and a text block for details as shown below.
This template is a very good starting point for most simple applications. Even if you do not believe you want to start with this template, I would at least recommend dissecting the XAML (eXtensible Application Markup Language) and source code. From a learning perspective alone, you can see how data binding is accomplished in both a list and a detail page as well as simple navigation.
Windows Phone Pivot Application
The next step up in templates is the Windows Phone Pivot Application. The Windows Phone Pivot Application template is really meant to help you get started in creating apps that utilize the pivot control. The pivot control is one of the more unique aspects of apps on Windows Phone 7 in that the user can swipe from left to right or right to left to switch the view. Most commonly, the views are simple lists which you then drill into. The WP7 built-in mail application is an example of an app that uses the pivot control. The template provides you with a single page as well as sample data sources to populate the two pivot items.
This template is a very good starting point if you need to display multiple lists, such as a mail client, as the user interface is very simple for a user.
Windows Phone Panorama Application
The Windows Phone Panorama Application template is very similar to the pivot template in usage with a different overall design. The template provides you with almost identical components for your project minus changes to the main page as shown below.
The panorama template could be used almost interchangeably with the pivot template above. The choice of which one to use really depends mainly upon styling and the slight difference in user action between the two underlying controls.
As you can see from the four templates discussed above, it is quite easy to jump in and start building your application. The only thing you really need to decide before choosing the template is how you want users to interact at the start of your app. It boils down to a couple of choices for the templates free form, list/detail or multiple lists (with two different styles). Even if you decide to change the interactivity down stream you are not stuck, you can still make the code changes manually.
About the Author: Chris Bennett is a Manager with Crowe Horwath LLP in the Indianapolis office. He can be reached at email@example.com