Search code examples
c#wpfmvvmprism

How to get the current active view in a region using PRISM?


I know that i can get all the registered views in a region with :

var vs = mRegionManager.Regions[RegionNames.MainRegionStatic].Views.ToList();

and i can see there is the following code :

mRegionManager.Regions[RegionNames.MainRegionStatic].ActiveViews

which is giving a list of Active View, but I'm having my region attached to a ContentControl which always has a single ActiveView. Am i misunderstood or is there a way to get the single active view?


Solution

  • var singleView = regionManager.Regions["MyRegion"].ActiveViews.FirstOrDefault();