Writing “Hello World” program for Windows Phone 7

Windows Phone 7 (WP7) is a cool new mobile platform from Microsoft. Developers can use Silverlight, XNA Framework and of course .NET compact framework for developing applications for WP7.

What do you need

To get started, download and install the following tools on your Windows 7 or Vista PC.


Installation includes Visual Studio 2010, Expression Blend, Windows Phone Emulator, XNA Game studio along with all the documentation required for writing your next great app.

Note that if Visual Studio 2010 Professional or above is already installed on the PC then only an Add-in for Windows Phone development is installed rather than complete installation of Visual Studio 2010 Express Edition.

To familiarize with the development environment its better to first develop a simple Silverlight application.

Create Hello World Project in SilverLight

1. Launch Visual Studio and Select File -> New Project command.
2. Select SilverLight for Windows Phone as template and Windows Phone Application as project type.
3. Specify HelloWorld as project name and Click OK button.
4. Wizard will create all the necessary files as the foundation for our HelloWorld application.

What Wizard generates

Most important files are generated by the wizard are:
1. MainPage.xaml : Default page with some UI element.
2. App.xaml : This file is used to declare shared application resources like colors, brushes, fonts and various style objects. The code-behind file app.xaml.cs is used to handle global application level events like Application_Startup, Application_Exit and Application_UnhandledException.

Building the Project
Since this is the first application built with the newly installed dev environment, its good to build the default project to rule out any installation problems. Right-click on the Solution in the Solution Explorer and Select Build command.

The build is successful if you will see the following message in the output window.

“========== Build: 1 succeeded or up-to-date, 0 failed, 0 skipped ==========”

All is good at this stage. Go to Windows Explorer and browse to .HelloWorldHelloWorldBinDebug folder and you will find HelloWorld.xap which is your actual compiled and compressed Silverlight application.

Lets enhance the program by adding “Hello World” functionality :).

Adding Hello World Stuff

1. Select “My Application” text block in the design view or in XAML view and change it to say, “42Gears”.
2. Select “page title” text block and change it to “Hello World”.

Build the project and a new HelloWorld.xap file will be generated.

Running Hello World Program

Now you are ready to launch the application. Press F5 to start debugging or Ctrl-F5 to Start without debugging. Windows Phone 7 emulator will be launched and HelloWorld.xap will be deployed and your first application will start running on the emulator.

For the first time it will take sometime for the emulator to start. Once its running, you can hit F5 or Ctrl-F5 to quickly deploy and run your application.

Well.. thats all for the HelloWorld application for Windows Phone 7. Future posts will involve more advanced topics. Stay tuned!

Exclusive News and Updates on Enterprise Mobility!

Subscribe for our free newsletter


  1. Frank Sydenham on April 6, 2010 at 6:08 am

    Windows Phone 7 is a great platform for developing a Hello World app with a pretty Silverlight interface. But that’s about all.

    The APIs and SDK of WP7 is not up to doing more complex apps. It is really only suitable for very simple “feature phone” type apps, and nothing more.

    I think when people realize that WP7 will be missing those complex apps, the platform will be a lot less appealing. It will take Microsoft about 2 years to bring the APIs up to standard, in which time there won’t be any app market left. Everyone will have gone to Android and iPhone.

    • Onkar on April 6, 2010 at 7:35 am

      Thanks for your comment.

      This is a Community Technology Preview (CTP) release and it’s been only couple of weeks since these tools were released. There is so much more to explore and try. I hope the final version which comes out later this year will be more powerful. Also in my opinion XNA framework support is going boost the image of this platform.

Leave a Comment