Monday, March 29, 2010

My First Windows Phone 7 Application

This is a walkthrough on creating a sample RSS reader for Windows Phone 7 (WP7), make sure to check my previous post for some useful links on how to start developing for WP7

  • create a new Windows Phone List Application: this project template provides you with a sample application that contains two pages, the main page for displaying a list of items, when you click on one of the list items a nice transition takes you to the second page which displays the list items details


  • we will use this sample list application as starting point for creating our RSS reader, we will have 3 pages, the first will have a list of RSS feeds, when we click on each feed we will go to the second page that contains a list of the items available in this feed, and when we click on a particular item we move to the third page which displays the feed item details
  • let’s start by defining our data models, the Windows Phone List Application project template provides you with a sample view model classes in the ViewModels folder, it also provides a sample data in the SampleData/MainViewModelSampleData.xaml file, this data is used by the visual studio and blend designer so that you can see (at design time) how your controls will look like when it’s bound to data.
  • we will create three view model classes in the ViewModels folder:

RssReaderViewModel: represents the main view model, contains a list of Feeds


FeedViewModel: represents the feed view model, contains the feed name, feed URL and a list of feed items


FeedItemViewModel: represent the feed item details, contains title, description, URL and publishing date


  • we will create three xaml files to use as sample data







  • Now our project structure will look like the following


  • the MainPage.xaml is the main page, it contains a ListBox that displays the feeds


in the page constructor the DataContext is set to a new instance of the RssReaderViewModel class, and as you can see in the xaml file the ListBox ItemsSource property is bound to the Feeds collection, when you click on an item in the list the selected item is captured and a nice transition begins (provided by default in the Windows Phone List Application project template), once the transition completes the application navigates to FeedViewModelSampleData.xaml and sets the DataContext to the selected item


  • the FeedDetailsPage.xaml page has a ListBox that is bound to the Items property of the FeedViewModel class 12

in the constructor the RSS feed is downloaded and the items in the RSS feed is used to populate the Items collection in the FeedViewModel class


when we click on the ListBox we capture the selected item and a nice transition animation begins, once completed we navigate to the FeedItemDetailsPage.xaml page and sets the DataContext to the selected item


  • the FeedItemDetailsPage.xaml page will display the feed item details (title, description, date published)


That’s pretty much everything in the application, You can download the source code from here

Sunday, March 21, 2010

Tuesday, March 02, 2010

TechEd Dubai 2010

Yesterday was the opening for TechEd Dubai 2010, the first TechEd in the middle east, Eric Rudder was the keynote speaker, a major announcement made by Eric was that windows azure offering will be available for the middle east in the coming year, also Microsoft will have a datacenter in the middle east soon.