Navigation and parameters

Topics: Prism v4 - Silverlight 4
Feb 1, 2011 at 4:53 PM
Edited Feb 1, 2011 at 4:56 PM


Hi everyone!
I have a small question about navigation parameters.
There are two views in my program: Customers and EditCustomer.
The EditCutomer view has two buttons: Save and Cancel. When I click the Save button, I send through the navigation parameters [ResetView] = true
(regionManager.RequestNavigate(RegionNames.MainContentRegion, new Uri(builder.ToString(), UriKind.Relative)))
and update the list of customers in the Customers view. If after that I'll be editing the second customer and press Cancel, then Customers view again get [ResetView] = true
How do I clear the navigation parameters in the second case?


Feb 1, 2011 at 9:38 PM


Based on my understanding of your scenario, you need to refresh the list of customers only when you save them on the edit CustomerEditView, by passing ResetView parameter.

Please take into account, is not possible to clear the NavigationContext Parameters´s property since is read-only.

In case you need to go back without sending the refresh parameter, you could navigate to the CustomerView by simply retrieving the RegionManager and navigate again to the view.

For example:

var regionManager = ServiceLocator.Current.GetInstance<IRegionManager>();
regionManager.RequestNavigate(RegionNames.CustomerRegion, CustomerView);

In the other hand, regarding NavigationService.GoBack() method, as documentation shows “Navigates to the most recent entry in back navigation history, if there is one”. That says, your first view is going to be loaded exactly the same way when you start the navigation process.

You can read more about Navigation, in Prism documentation Chapter 8: Navigation.

I hope you find this information useful.


Miguel Bronzovic


Feb 1, 2011 at 10:09 PM

Thanks for the answer!