Getting handle on Scoped Region

Nov 21, 2008 at 8:32 PM
How can I get a handle on a Scoped Region and/or it's RegionManager WITHOUT adding another view to it. Another issue related to same question is how to check the existence of a view inside a scoped region. I want to do it without adding another view just to get regionmanager's handle. I hope my question is clear enough. If not then I'll supplement with a code snippet - just ask.
Nov 21, 2008 at 10:00 PM
The UIComposition.sln (I believe in the CompositeWPF 2008 RC1 June release) shows how it can be done in:

Modules \ Controllers \ EmployeesController.cs   OnEmployeeSelected() method 

It uses scoped regions for employee details and checks to ensure the view (within scoped region) wasn't already loaded before loading it.
Nov 24, 2008 at 1:20 PM
Thanks for your response but no that's not what I am looking for. The example code, you referred to, checks for view existence in DetailsRegion which has global scope. In case there was no matching view loaded in DetailsRegion, it adds a view and gets a Scoped RegionManager in return. And of course, once you have this handle, you can add more scoped views. However that's not what I was looking for. Below is the code snippet you referred to. In this code, I want to get a handle on ScopedRegionManager within else block of the code. Once I have this handle, I want to check the existence of a view within SCOPED region manager, not the global one.

public virtual void OnEmployeeSelected(BusinessEntities.Employee employee)
            IRegion detailsRegion = regionManager.Regions[RegionNames.DetailsRegion];
            object existingView = detailsRegion.GetView(employee.EmployeeId.ToString(CultureInfo.InvariantCulture));

            if (existingView == null)
                IProjectsListPresenter projectsListPresenter = this.container.Resolve<IProjectsListPresenter>();

                IEmployeesDetailsPresenter detailsPresenter = this.container.Resolve<IEmployeesDetailsPresenter>();

                IRegionManager detailsRegionManager = detailsRegion.Add(detailsPresenter.View, employee.EmployeeId.ToString(CultureInfo.InvariantCulture), true);
                IRegion region = detailsRegionManager.Regions[RegionNames.TabRegion];
                region.Add(projectsListPresenter.View, "CurrentProjectsView");