Region loses context during navigation

Topics: Prism v4 - WPF 4
Oct 21, 2011 at 4:20 AM
Edited Oct 21, 2011 at 4:26 AM

Hi there!

I've already posted this question on the StackOverflow, but there is no activity there.

There main idea is that when I navigate through views in the main app's region it's Context clears. Context clears cause of I implemented INavigationAware and IRegionMemberLifetime interfaces. I implemnted these interfaces cause of I need to recreate views and view models every navigation step.

You'll find two solutions: before and after. In the first solution views and views models are not recreated when you navigated to the first view, back and to the first view again. But Context still exists. In the second solution, views and view models are recreated but context loses.


What I'm doing wrong?

Oct 21, 2011 at 2:18 PM


Based on my understanding of your scenario, this might be related to a known issue in prism: when removing views that shares a region context with other views in a region, causes the region context in all the views in that region to be lost.

If this is your case you might find more information regarding that and a possible workaround in the following the following blog post:

I hope you find this helpful.

Agustin Adami