Developing Windows Phone 7.5 Mango Applications: Part 2 (HelloWorld app)

In our last tutorial, we saw the overview of Windows Phone 7.5 aka Mango and its developer tool. Now before we move on, I want to clarify one thing. Some of you might be thinking that what exactly is the difference between Windows Phone 7 and its latest upgraded version 7.5?

Well, the answer is as all upgrades do, Windows Phone 7.5 aka mango has brought some fine features to the smart phones like Bing Vision, Bing Audio, SMS dictation and Turn-By-Turn navigation extending Windows Phone 7’s functionality further. Newly launched Windows Phone 7.5 also sports Windows Live Messenger integrated into people hub and Bing image search.

Now, let us get back to our main tutorial subject and that is Application Development for Windows Phone 7.5. Now as we seen in last tutorial, there are 2 sections of a developer page, namely C# section, XAML section and Solution explorer and visual section. There is another sub section which you probably would have come across by now and that is Windows Phone Emulator section.

Let us write a simple application assuming that you already know basic syntax of C#. In this application, we will have one button and one text block. Upon clicking button, the textblock will display some text, all pretty simple! Although it will be a simple app, it will give you overall idea about developing an app for Windows Phone 7.

WP-developer-tool

Now create a new project with any suitable name, but for reference let’s develop habit of naming projects as test 1, test 2 and so on. So after creating test 1 project, you will get familiar screen of Windows Mobile 7 developer’s tool.

Now pull down a button and a text block from toolbox to your lower section of Visual section, i.e. on the copy of Windows Phone Emulator. Position them suiting your choice, only make sure that you text block is bigger enough to contain several words.

After you have dropped these controls on layout, label them with some meaningful name using property menu (e.g. for textblock – txtop). Now it is the time to write the first line of code in our very first program.

Now we want something to happen when we click buttons, so double-click on button control placed in layout. You will get a new Window for writing C# code (see image).

WP-dev-tool-csharp

So in the pair of curly braces, write this code:

txtop.text = “hello”;

After saving this project run it by pressing F5. Emulator screen will pop-up and you will get your button and textblock on its screen. Now try pressing the button. Ta-da, congrats you just have successfully created your first application on Windows Phone 7.5.

Let us now dissect our application in brief. Clicking button twice created a button_click event which specifies what should happen when user click on that button in run-time. We defined that if user presses this button, textblock’s text property should be changed to “Hello World” and thus we got “Hello world” in run-time.

In the next chapter we will take a look at what are variables, how to declare them and how to accept input and assign value to textboxes.

P.S. You can find more about naming conventions and default properties of controls on the Internet.

Posted by on , in Category General with Tags
Gadget freak, Apple lover, Windows Phone lover; well that’s me! I have been in this wonderful field of freelance writing for quite some time and looking forward to developing more illuminating content related to gadgets and technology, as I go along.

8 Comments

  1. Nidhi

    look awesome.

  2. Asrartheone

    “So in the pair of curly braces, write this code:
    txtop.text = “hello”; ”

    There are actually 4 sets of curly braces here. In which block of code to write this ? Would be great if you specify the method name too while writing code inside these braces as here the method name is button1_Click() .

    This would make things clearer for the reader.

  3. Well, nice tutor but you have written “assuming that you already know basic syntax of C#”…There might be some readers (like me) who have no idea about syntax of c#…Can u plz explain a little about it too?

  4. aavishkar

    ok Asratheone, will specify all the details from now on…..and gaurav C# syntax is almost same as java or c++ syntax so if you know any of the above language it will be very easy for you :)… I couldn’t add every minute details because of lack of space but will work on your suggestions..

  5. A XVI

    I still don’t know where to put the textop line.

  6. Aavishkar

    You need to put that line in curly braces following the line given below:
    private void Button1_Click(Object Sender, RoutedEventArgs e)
    {
    ** Your line **
    }

  7. A XVI

    Hehe figured it out after hours of searching. Also, the properties need to start with a capital letter, like text1.Text instead of text1.text … I kept getting errors because of that but XDA helped. 🙂 Good tutorial though.

  8. Aavishkar

    thnx 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *


4 + 4 =