This guide is accurate as of 12 August 2010, using Windows Phone 7 Beta SDK..
Seems like this will be the opening post for our Developers’ corner , Windows Phone 7 Navigation. Recently, I have been doing alot development on Windows Phone 7, for demostrations, for projects and many other stuffs and one of the most basic thing that people will ask when they start a development is how to navigate from “page” to “page”. ( In fact, a handful people had asked me already.) This tutorial shows us how to use the NavigationService.Navigate().
1. Create a Windows Phone 7 Silverlight project on Visual Studio. I named it as NavigationService


2. Create a new page by right clicking on your solution explorer and add a new item and choose Windows Phone Potrait page call Page2.xaml


3. We need to set some stuffs in the second page and main page so we know it navigated. I made use of the properties window. If you cant find your properties window, you can do a Ctrl+W, P.
This are what i changed and added.
Edit the PageTitle in MainPage.xaml
—Text : Page 1
Edit the PageTitle in Page2.xaml
—Text : Page 2
Add a button in MainPage.xaml
—Name : btnGo
—Content : Go to Page 2
4. Lets add some code for Navigation in, double click on the button you created on MainPage.xaml, it should generate a click event handler for your button, btnGo. Add this in.
1 | NavigationService.Navigate(new Uri("/Page2.xaml", UriKind.Relative)); |
5. F5 and see if your Page 1 changes to Page 2!!
Sample Code : Download sample code
Do visit out Developers’ corner for other guides!
Should there be any problem, please feel free to contact me at guohong ( at ) limguohong ( dot ) com







