switching Views

Topics: Prism v2 - WPF 3.5
Dec 18, 2009 at 10:32 AM


I'm still having problems switching views in a region, I have been using one of the QuickStarts as as example but no luck.

I have the following cod ein my module controller, and although it works frist time in (Adding the view to the region), i get an exception if the view already exists and I attempt to activate it:

IRegion navigationRegion = regionManager.Regions[RegionNames.MainNavigation];
            object navView = navigationRegion.GetView("PluginNavigation");

            if (navView == null)
                MessageBox.Show("Adding view to region");
                navigationRegion.Add(this.container.Resolve(typeof(NavigationView)), "PluginNavigation");
                //MessageBox.Show("Activating view in region");
                MessageBox.Show("Activating view in region");

Any help much appreciated.




Dec 18, 2009 at 11:16 AM

problem solved, should have been Activating the view using .... navigationRegion.Activate(navView) - doh!