basic view switching navigation question

Topics: Prism v4 - WPF 4
May 12, 2011 at 8:22 PM

Just looking into Prism, I'm going through the walkthroughs and they are great but the navigation one is giving me problems. In order to better understand I've built a simple app with two modules, one region. In both of the modules Initialize methods I register the respective view with the region. 

What is confusing me is both views seem to be active. How would I switch back and forth between the two (after they have both been registered)?

I've implemented IConfirmNavigationRequest and can walk through the calls to the region after I call RequestNavigate, but I guess I'm not sure what to do to get rid of the old region, (and surprised that I would have to do anything at all).

May 13, 2011 at 3:30 AM

What are you using as your region container? ItemsControl/ContentControl or Grid? Based on your description above looks like you have the itemscontrol as your region host. ItemsControl has a AllActiveRegion which is why all views that load into the region remain active. ContentControl has a SingleActiveRegion, which probably what you need, which only keeps one view active at a time.

Also read up on the RegionMemberLifetime attribute. That will tell then region how to deal with the view.