In the prism docs a scoped RegionManager is created somehow like this:
IRegion detailsRegion = this.regionManager.Regions["DetailsRegion"];
View view = new View();
bool createRegionManagerScope = true;
IRegionManager detailsRegionManager = detailsRegion.Add(view, null,
createRegionManagerScope);
I have a modular app in which the view is located in another module, and the region is in the main assembly. There are regions in every module that I want them to have the same view, that same view is located in the main assembly then. This drawing may explain it better:
So if I want to use the region.Add method in a module, I can't instantiate the view because it's located in the main assembly.
Another way I thought of was to use view discovery, i.e. using RegisterViewWithRegion(string regionName, Type viewType), because I can call this method in the main assembly where I have access to viewType, and use the regionName I passed to this method in the modules. But the problem is I can't have regions with the same name in the modules.
I ended up doing what I have written in this answer, But my manager is saying that I'm violating MVVM by creating the RegionManager in the view-model.
What is the right way to use scoped RegionManager in this situation?

First, a module has nothing to do with a view - a module is a late-bound, interchangable part of the software.
You don't call
new, anyway, because the container does it for you.So you inject a factory into the class that wants to create the view (the simplest way being a
Func<View>), and the class uses the factory to create the view. In this case it doesn't matter at all, where the view's or the factory's code resides, as long as you have interfaces (that's a different thing than aninterface, although aninterfacesitting in a third assembly that itself doesn't belong to any module is common) in place that the modules can use to talk to each other.