When we develop an application for Windows Phone 7. One of the problem that a developer will face at the most is the circular navigation. On the phone, the navigation service handle the stack used by the back button. So each time we call the method Navigate of the NavigationService, a new entry is stored in the stack. On the other side there are some rules that a developer must follow to pass the certification on the Marketplace:
- circular navigation is not allowed
- the back button on the home page must exit the application.
There is some times that the scenarios doesn’t fit the rules for the Marketplace. So we end up more often with a circular navigation. Also which doesn’t help, it’s that we don’t have access to modify the navigation stack. This issue probably occurred very often in the certification process. First because, the developer did look at the Requirement documentation before creating his application. And second, because there is some times that the limitation doesn’t give us much choice.
(Image taken from the Windows Phone team blog)
So Microsoft listen and provide us with a solution. I’m glad because i had to use it in one of our application recently. The solution is pretty simple, we have to add a class in our application. Instantiate that class in the App class (App.xaml.cs). After what, we continue to handle the navigation as usual, but if we forgot to handle the back navigation or we face a scenario where we cannot handle the back navigation properly, we just have to navigate to the desired page (ex: navigate to the home page). At that time, if the class identify a circular navigation it will automatically handle the back navigation for us until we end up to the specified page.
But don’t be to lazy, and don’t rely on that mechanism. You should be aware of the Marketplace requirement first and follow them. But if in a specific case you don’t have a choice then you have a solution.
Get the code:
Get more information about the non-linear navigation:
I hope this will help you.
Last week finalized the implementation for the support of Visual Basic for the Windows Phone Developer Tools. So now any developer with Visual Basic background can now build Windows Phone application (and Game based on Silverlight).
So to be able to start building Windows Phone application with Visual Basic you need to have Visual Studio 2010 Pro or higher (at this time Visual Studio 2010 Express is not supported). You also require the Windows Phone Developer Tools and the addon for the support of Visual Basic (download here)
For more information, you can read the official post on the Windows Phone Developer Blog here.
Have a good time developing Windows Phone 7 application!