Creating a Silverlight Application for Windows Phone 7


With Windows Phone 7 now hitting the shelves, there will be a rush of developers heading out with the developer tools to make the next “Angry Birds” or the Netflix app. As we say in an earlier article, Microsoft has done a great job of providing a great set of developer tools to work on to build applications for the Windows Phone at the right price, free. Yes, you heard it right, free. The developer tools are free and you can see all the details on how to get started in an earlier article (point a link to that “Getting started with windows phone developer tools article here) Windows Phone architecture allows developers to choose between 2 different frameworks for making applications/games for the Windows Phone. In this article we will focus on using the Silverlight framework for making Windows Phone applications.

Why Silverlight?

A fair question to ask is why use the Silverlight framework to make applications on the Windows Phone.

Silverlight, often called a Flash compete offering from Microsoft, has provided web developers the ability to make rich internet applications. For programs which require application-logic or are utilities, you will want to use Silverlight. A complete scenario analysis on which framework to select for your Windows Phone application is provided in the article linked above.

Getting Started with Silverlight Projects in Microsoft Visual Studio

After you are done installing the developer tools for Windows Phone, you can fire up Visual Studio Express for Windows Phone or if you have Visual Studio 2010 Pro SKUs already installed, you can launch that and choose File -> New -> Project and select Silverlight for Windows Phone 7 from the template types.

select Silverlight for Windows Phone 7 from the template types
Figure 1

Here you will notice a bunch of templates. Depending on the type of application, you can choose the most appropriate template for the job.

WP7 - Choose the most appropriate template for the job

For our demo, we will choose the basic “Windows Phone Application” template. Let’s name our Project WindowsPhoneApplicationDemo and press Enter to create the project.

Once we click Enter, the IDE goes into actions and creates a bunch of files – Appl.xaml, MainPage.xaml and other image files ApplicationIcon.png, Background.png and SplashScreenImage.jpg.

Let us look at what these files are:

Created Files from template

To see the Designer view, right click on MainPage.xaml and click View Designer (if the designer is not already available). Here you should be able to see the Designer as well as the code behind.

two TextBox controls and one Button control
Figure 2

More by Author

Must Read