Preparing Your Development Machine
At the time of writing this
book, Windows Phone 7 developer tool beta version 1.0 was used. The
latest Windows Phone developer tool can be downloaded from http://developer.windowsphone.com/windows-phone-7/. The Windows Phone developer beta tools (vm_web.exe) will install the following:
In this section, you'll build a simple "HelloWorld"
application using Silverlight framework. Creating the application will
provide you with an opportunity to use Visual Studio 2010 Express for
Windows Phone, the Windows Phone 7 Emulator, and some Windows Phone
Any commercial version of Visual Studio 2010 or free version of Visual Studio 2010 Express for Windows Phone: Programmer's development IDE.
Windows Phone emulator: Used to run and test the Windows Phone application.
Silverlight for Windows Phone: Silverlight Framework for Windows Phone based on Silverlight 3 technology.
Microsoft Expression Blend for Windows Phone: Can be used to design user interfaces.
XNA Game Studio 4: Tools for developing games.
1. Creating a Windows Phone Project
To get started, you first fire up Visual Studio Express 2010 and create a project.
To launch Visual Studio 2010 Express, select Windows Start => All Programs =>Microsoft Visual Studio 2010 Express => Microsoft Visual Studio 2010 Express for Windows Phone.
Create a new project by selecting File => New => Project on the Visual Studio menu, as shown in Figure 1.
Figure 1. Creating a new project
among the three C# templates that Visual Studio displays on its New
Project dialog page, select the Windows Phone Application Visual C#
template, as shown in Figure 2.
There are three
different Windows Phone Visual Studio project templates. The Windows
Phone Application template is a template for one-page applications. The
Windows Phone List Application template uses ListBox control and page
navigation framework to create applications with multiple pages. The
Windows Phone Class Library template can be used to create a class
library that can be referenced by other Windows Phone projects.
the purposes of this exercise, change the Name of the new project to
"HelloWorld," by changing the text in the Name box, as shown in Figure 2. Also you can change the location where the project will be saved by changing the path in the Location box.
Figure 2. Creating a new Silverlight Windows Phone application
Finally, select OK on the New Project dialog, and Visual Studio 2010 will build your project, whose elements are displayed in Figure 3.
Figure 3. HelloWorld Silverlight Windows Phone project
By default two TextBlock controls will be placed in Windows Phone, and you can see this in design view on the far left in Figure 3.
With a phone project
ready to roll, it's time to bring the application to life by adding some
functionality and creating a user interface. We'll start with the
interface, adding some controls to its blank design surface for users to
press and in which the application can display text.