Mixing Prism4 Navigation with IRegion.Add

Topics: Prism v4 - WPF 4
Feb 11, 2011 at 4:40 PM

I'm developing a Prism4 WPF application with 1 region and several views. To date I've been using view injection via IRegion Add/Activate/Remove to control the views (in response to menu selections). Works great.

Now I'd like to mix in some view navigation where the 'IRegion.Add'ed views can navigate to other views and pass parameters. This is where I've run into some trouble...

Part (if not all) of the trouble seems to be that the views added to the region with IRegion.Add don't have an existing navigation journal entry when RequestNavigate is called. The NavigateTo view gets loaded but it can't navigate back (apparently) because the originating view has no journal entry. Shouldn't RequestNavigate create a journal entry for the NavigateFrom view?

I've found that I work around this issue by having the 'from' view navigate to itself first (if the journal's CurrentEntry is null). That creates a journal entry for the 'from' view and then the navigate 'to' view can go back the original view. But this has some serious 'code smell' and adds complication the the navigation process.

Is mixing and matching IRegion.Add/Activate with RequestNavigate a supported scenario? Is there a better way to initialize the journal so going back to an 'IRegion.Add'ed view works?



Feb 11, 2011 at 6:47 PM

Hi Jim,

Take into account that when you add views into a region, you are not currently navigate to that view. The same applies when you remove views on a region.

Views are been registered into the Journal only when you call the RequestNavigate method.

You can read more about Prism Navigation in the following links:

I hope you find this information useful.


Miguel Bronzovic