I have a simple Silverlight application that consists of four pages (XAMLs).
Navigation is done by calling:
//from XamlPageA
this.Content = new XamlPageB();
Is this the right way. I need to have the entries in Browser history so that users can go page to the previous page(s). How can I do it.
You are bypassing the navigation system completely by setting content manually. You would have to implement updating the browser history yourself if you do it that way (certainly possible, but quite tedious).
A simpler approach is to generate a “Silverlight Business Application” project and see how the page navigation is simply handled with hyperlink buttons. All the browser history plumbing is done for you as is the mapping from URL to views.
e.g. A button with
NavigateUri="/Home"will cause a view named Home.xaml to load into thenavigation:Frameof the MainPage window.if you look into the
navigation:Frameelement of MainPage.xaml, you will see a number of UriMapping entries like this:They provide the pattern matching to convert from URLs to views.
Hope this helps your project.