OpenLightGroup Blog


Blogs from

Windows Phone 7 Development for Absolute Beginners (The parts you care about)

Microsoft has posted a great series Windows Phone 7 Development for Absolute Beginners. However, it starts with “how to program”. This might drive you crazy if you already know how to program Smile. Also, if you are like me and simply want the links to download the videos and the code, this should help:


Isolated Storage, ListBox and DataTemplates

In a continuation of the previous video, Bob demonstrates how to read a list of file names saved to the phone's flash drive and display those names in a ListBox. Each file name is displayed in a DataTemplate that contains a HyperlinkButton. This results in one Hyperlink button for each file name. Bob then demonstrates how to pass the file name in the QueryString to a second Silverlight page that allows the user to view the contents of the file.

Download the source code


Tombstoning and Task Switching

How does your application respond when a user clicks the Start button or Back button on Windows Phone 7?  In this video, Bob explains the difference between the Launched, Activated, Closed, and Deactivated events, how your application can be notified via event handlers in the App.xaml.cs code-behind file, and how to take that opportunity to save the current state of the application. Then, once the user has re-launched the applications, the state information can be retrieved and the state of the application from the previous session can be restored. Bob also explains how a special feature of Isolated Storage called IsolatedStorageSettings can provide an easy way to save name / value pair information without having to create and access a text file.

Download the source code


Adding Different Input Scopes

The Windows Phone 7 includes dozens of input scopes, also known as specialized keyboards that enable users to type in web addresses, chat messages, addresses, and more. Each input scope is tailored to make the given operation easier. Bob shows how to declare an input scope for an input control (like a TextBox) so that you can display the right input scope for the job.

Download the source code


GPS, Location API and Calling Web Services

Each Windows Phone 7 includes a Global Positioning System (GPS) that allows the phone to determine the latitude and longitude of the device. In this video, we first look at a special part of the Windows Phone 7 API to access the Geo Location information. Then, once we have the coordinates, we call a Web Service—a "method hosted on a web server," which when given the coordinates will return the city, state, and country names—and we use this to display the location of the device on screen.

Download the source code


Image Background, Orientation Changes and Control Visibility

In the final instructional video for Day 3, Bob covers several topics, such as using an Image for the background of a Silverlight page, how to set the supported orientations for a page, and how to use the rectangle object to provide a slightly opaque black background that allows white text to pop out from an otherwise low contrast image.

Download the source code


Day 3 Homework Assignment

Congratulations! You made it through the instructional portion of this video series. Now let's see what you can do on your own. In this assignment, you'll build a simplified version of our note taking application.  IMPORTANT: before you peek at this video, please—for your own sake—try to complete this homework assignment on your own. You'll only learn through practice, frustration, and exploration.

Download the source code


Day 3 Homework Solution

Got stuck with the homework assignment?  No worries, simply watch enough of this solution video to get un-stuck, OR compare your solution with Bob's version. IMPORTANT: before you peek at this video, please—for your own sake—try to complete this homework assignment on your own. You'll only learn through practice, frustration, and exploration.

Download the source code


Day 4 Introduction

Today we'll be building an entire application from start to finish. The project will be a Geo-Location note taking application. As a user creates a new note, the location of where the note was composed will be saved along with the note. The user will be able to add notes, as well as edit or delete them. In this video, Bob lays out the plan for the rest of the day, including a demonstration of the application that we'll build, how we might design the application, and more.


Getting Started Activities

In this first video for our Day 4 project, Bob creates a new project, adds files for the Add and EditDelete note pages, and sets some of the basic properties of each page.

Download the source code


Initial MainPage Setup

Next up for our Day 4 application, we add the controls, set the properties for the MainPage.xaml, and discuss how the ListBox will work.

Download the source code


Creating the Note Naming Convention

In this video, Bob discusses the strategy of using the file name as a means of storing the date and time the note was created, along with the location of the note’s composition. This requires quite a bit of familiarity with String and DateTime classes and their methods for formatting and parsing through data.

Download the source code


Binding the Note Class to the ListBox DataTemplate

Now that we have and can create files with the naming convention, we want to retrieve the names of the files, parse their contents, and display them in a ListBox. In this video, Bob shows how to use the DataTemplate to display both the note's location and date in the ListBox using a HyperlinkButton and a TextBlock.

Download the source code


Initial Add Note Page Setup

Time to move on to the next part of our Geo Location Note taking application and provide the ability for the user to add a new note. In this video, Bob adds the code required to navigate to the Add page from the MainPage.xaml, and adds both the TextBox control and Input Scope for the note.

Download the source code


Calling the TerraService Web Service

In this video Bob uses the Day 3 example to call the TerraService passing the coordinates from the phone's GPS to the web service in order to retrieve the city, state, and country. These values are saved in a private member variable of the class, which can be used when the note is saved.

Download the source code


Saving a New Note

Now that we have all the parts we need, it's time to construct the file name and save the file's text. Then, we’ll navigate back to the MainPage.xaml and see the new note in the ListBox.

Download the source code


Initial ViewEdit Page Setup

In this video, Bob sets up the controls required to both display and edit the note. He also adds the icons for the various features of this page, including back, edit, save, and delete buttons.

Download the source code


Navigation Between MainPage and ViewEdit Pages

Bob wires up the navigation between the MainPage.xaml's ListBox and the ViewEdit.xaml page. In the process, we learn about the Tag property of the HyperlinkButton to store the filename of each item in the DataTemplate. Using this, a QueryString can be constructed and used to pass the file name of the desired file to the ViewEdit.xaml page.

Download the source code


Switching to Edit Mode on the ViewEdit Page and Saving Changes

In this video Bob uses previously discussed techniques to switch back and forth between view and edit modes by copying the content from the TextBlock to the TextBox before setting the visibility of each control. Finally, the data changes are applied to the underlying file.

Download the source code


ViewEdit Page's Delete Note Functionality

Delete functionality allows a user viewing a note to delete it and return back to the list of notes. This video shows both how we enable that feature and—as Bob demonstrated on Day 3—how to display a Canvas dialog to warn the user about deleting the note.

Download the source code


Adding Help Screen on MainPage

Using the Canvas dialog technique again, Bob adds a Help dialog to the MainPage.xaml. He uses both a Button control and an icon to enable the closing of the dialog, and adds a ScrollViewer to allow more text than can fit on the screen to be presented.

Download the source code


Storing Application State Part 1 - MainPage

Now that the majority of the functionality is complete, Bob starts hardening the application by considering what happens on each of the three Silverlight pages when the user clicks the Back or Start buttons. Using the lessons learned from the Tombstoning and Task Switching discussion on Day 3, Bob decides how to handle this situation and starts down the path, detecting the user’s location before clicking the Start or Back buttons and restoring the user to that exact state when the application is next launched.

Download the source code


Storing Application State Part 2 - Add Page

This video continues working through the Tombstoning and Task Switching scenario, enabling the scenario for the Add.xaml page.

Download the source code


Storing Application State Part 3 - ViewEdit Page

This video continues working through the Tombstoning and Task Switching scenario, enabling the scenario for the ViewEdit.xaml page.

Download the source code


Debugging the Empty FileName Issue

In the previous video, we were left with an error, requiring that we take the time to track down the problem and fix it. This video shows the thought process behind debugging the problem and how to find the its true source.

Download the source code


Code Cleanup, Exception Handling, and Preparing for the Marketplace

Nearing the end of development, Bob shows how he cleans up the code and combs through it to include better code comments. He also shows where to download the Windows Phone 7 Requirements PDF, and outlines the dos and don'ts for BEFORE you attempt to submit your application for inclusion in the market place. He also replaces the icons and creates other graphic resources required by this process.

Download the source code


Comments are closed.
Showing 1 Comment
Avatar  M.V.Priyank 8 years ago

Thanks for sharing this valuable info. This would be very useful for beginners :)<br>@mvpriyank