4.2 beta Navigation journal entries + NavigationParameters

Topics: Prism v4 - WPF 4
Mar 10, 2014 at 3:23 PM
Edited Mar 14, 2014 at 3:37 PM
Now that you can pass in separate Navigation parameters, it makes it a little difficult to use the Navigation Journal, as this does not include them.

Before I would do this:

var params = new UriQuery();
params.Add("SomeId", _someId.ToString());
regionmanager.RequestNavigate("SomeRegion", "SomeView" + params);

But now it would ideally be:

var params = new NavigationParameters();
params.Add("SomeId", _someId); //As an int
regionmanager.RequestNavigate("SomeRegion", "SomeView", params);

But this now means that the NavigationJournal is not aware of the parameters. And so on IsNavigationTarget method it cannot compare if it is the correct viewmodel and so tries to open up a new one. As in some views they are editing records, so it always brings the same one back if they are editing that one.
Mar 14, 2014 at 3:39 PM
Any advice on this? It would be appreciated, I've broken things in journal navigation at present, but could do with a best way to handle these kind of situations.
Mar 18, 2014 at 3:34 PM
Hi James,

The next drop of Prism has this issue addressed, as navigation parameters are saved in the Navigation Journal. However, as a very easy workaround for now, you could use the old approach of passing query string parameters, since you just needs an int to be passed, in the following way.

var params = new NavigationParameters();
params.Add("SomeId", _someId); //As an int or string
regionmanager.RequestNavigate("SomeRegion", "SomeView" + params.ToString());

This is the old way of doing it and it is still supported in Prism, but now the UriQuery class is renamed to NavigationParameters, maintaining the old functionality and adding support for object parameters.

Hope this helps,
Diego Poza
Mar 18, 2014 at 3:39 PM
Ahh that's good then! Any idea on the time scale of this next drop?
Apr 14, 2014 at 10:04 AM
Sorry to chase on this. But what's happening? Haven't seen any news on the actual release of 4.2 for a while now?
Apr 16, 2014 at 9:09 PM
We will finish everything this week and publish early next week. Documentation is taking longer than expected.
Apr 18, 2014 at 6:41 PM
The release is complete and we are now starting to publish the different components. We just published the NuGet packages.