Navigation Stack on Windows Phone 7

While Windows Phone uses the same NavigationService and page-based model as “regular” Silverlight, one area the documentation doesn’t make clear is that although the APIs seem to support both Back and Forward navigation in reality there is no forward navigation on Windows Phone. This means when you navigate to a new page and then return Back to the previous page you can’t call NavigationService.GoForward() to return. CanGoForward will always return False. In the documentation for System.Windows.Controls.Frame (the base class of PhoneApplicationFrame) GoForward is described as:-

“Navigates to the most recent entry in the forward navigation history, or throws an exception if no entry exists in forward navigation. For Windows Phone this method will always throw an exception because there is no forward navigation stack.”

(my use of bold)

And yet in NavigationService:-

“Navigates to the most recent entry in the forward navigation history, or throws an exception if no entry exists in forward navigation.”

It makes perfect sense because there is no mechanism to browse forward on the phone unless you add buttons/menus onto your pages manually of course, but the documentation doesn’t spell out this difference from “regular” Silverlight very clearly.

Advertisements