Windows Phone

Got a Windows Phone 7 and want to write some cools apps for it? Microsoft has release some tools to the public so that programmers like yourself can get started! You actually don’t need a Windows Phone because the kit comes with an emulator. Anyways let get start by downloading the developer’s kit from the App Hub and press on “Download the free tools”.

The installation package includes the following:

  • Visual Studio 2010 Express
  • Windows Phone Emulator
  • Silver Light
  • XNA Game Studio 4.0
  • Microsoft Express Blend for Windows Phone
  • .NET Framework 4

    The installation might take a while so you will need to go and get yourself a cup of coffee or energy drink like “Mother

    From your Start Menu go to All Programs->Microsoft Visual Studio 2010 Express and run Microsoft Visual Studio 2010 for Windows Phone. You probably be familiar with this IDE because I looks exactly like the other 2010 Express IDEs.

    Start Page - Microsoft Visual Studio 2010 Express for Windows Phone_2010-11-28_23-32-58

    Now we want to create a new app by using a template, so you will need to go to File->New Project, now you will see a New Project dialog opened. On the left side of this window are your categorized Installed templates, so you want to select Visual C#->Silverlight for Windows Phone. Then on the middle of this window you will see a list of installed templates to choose from, we will select Windows Phone Application to start off. Now give your new project a new, I am going to call mine “myfirstapp” and then click OK button to continue.

    New Project_2010-11-28_23-37-21

    After your skeleton project has started, you will see on your left the familiar Toolbox this where all the visual controls are located. On the right side is your typical Solution Explorer and Properties. In the middle you will see a illustrated Windows Phone and XAML code. The Windows Phone in the IDE is your design window, so we are going to drop some controls in a while.

    myfirstapp - Microsoft Visual Studio 2010 Express for Windows Phone_2010-11-28_23-46-11

    On your design or PhoneApplicationPage window it consists of a Grid LayoutRoot which contains, at the top is a StackPanel TitlePanel and at the bottom is a Grid ContentPanel.

    Lets change the “page name” in the TextBlock TitlePanel by selecting the panel and got to Properties->Text and type “My First App”.

    myfirstapp - Microsoft Visual Studio 2010 Express for Windows Phone_2010-11-29_00-01-29

    myfirstapp - Microsoft Visual Studio 2010 Express for Windows Phone_2010-11-29_00-02-16

    Now we want to run this app in a Windows Phone emulator, press F6 on your keyboard to build the solutions and then press F5 to run. Make sure that you have Windows Phone 7 Emulator select from the tool bar.

    myfirstapp - Microsoft Visual Studio 2010 Express for Windows Phone_2010-11-29_00-07-45

    After the emulator has loaded it takes a while to deploy you application so be patients. Below is a screen capture of the emulator displaying “My First App”.

    Windows Phone Emulator_2010-11-29_00-10-08

    Well done you have just created your first Windows Phone 7 app! Ok that was really basic let’s do some more with it by adding a button and text box control. To stop running the application press Shift+F5.

    From the tool box I am going to drag and drop a Button and TextBox control on to the phone page.

    myfirstapp - Microsoft Visual Studio 2010 Express for Windows Phone_2010-11-29_00-28-27

    What I am going to do now is to add some code on the Button’s Click event to print something on to the TextBox control.

    Double click on the Button control, will automatically create a button click event member method. We will enter some code here:

    namespace myfirstapp
        public partial class MainPage : PhoneApplicationPage
            // Constructor
            public MainPage()
            private void button1_Click(object sender, RoutedEventArgs e)
                textBox1.Text = "This is my first app!";


    As you can see I have created a code to assign a string “This is my first app!” to the text property of the TextBox control.

    Press F5 to run the application and wait for the application to load on the Windows Phone emulator. When the application has finished loading press the Button and the text should display in the TextBox control.

    Windows Phone Emulator_2010-11-29_00-41-45

    Well done you have written your first Windows Phone 7 app and made it to display some text when you click on a button! Well I hope this blog will get you started with Windows Phone development, but I will try to write more blogs on Window Phone 7 development in the future.