[highlight]Create a simple navigation application in Windiows Phone 7 ( WP7 ) [highlight]
In a Windows Phone application it is highly probable that you will have more than one screen in your application and you will need to navigate between them. We can make use of the navigation framework for the same. This navigation will be very similar to navigating from one web page to another. This navigation framework also supports query string.
So without much talk let’s go ahead and create a simple business information application of financial company ACME and learn navigation in WP7.
- Goto visual studio 2010 and create new Windows Phone Silverlight and XNA Applicationand name it NavigationExample.
-
Add new folder to the NavigationExample named Views and inside Views add a new folder Locations.
-
Now add Windows Phone Portrait Page named About and Contact in the Views folder
-
Similarly add Windows Phone Portrait Page named Corporate Office and Satellite office in the Locations folder.
-
Now lets open the pages and edit the default text on the pages.
-
Open MainPage.xaml and edit the text to as shown in the image below. Also drag and drop four HypelinkButton onto the MainPage.xaml
-
Now edit the HyperlinkButtons to point to the proper pages to be navigated. Use the image below to do the same.MainPage.xaml
-
Now open about.xaml, contact.xaml, corporateoffice.xaml, satelliteoffice.xaml and edit the headings.
-
Now run the application and you will see the screen as below. You can also navigate to different screens.
You can download the full source code here
Please remember to leave your feedback or appreciations or questions. Thanks