I'v got the following code :
public class MyModule: IModule { private IRegionManager mRegionManager { get; set; }
public CMBaseTable(IRegionManager regMan) { mRegionManager = regMan; } public void Initialize() { mRegionManager.RegisterViewWithRegion("MainRegion",typeof(MyView)); var vs = mRegionManager.Regions["MainRegion"].Views;//<--- I get an exception here } }
In the line
var vs = mRegionManager.Regions["MainRegion"].Views;
I'll get an exception that says: KeyNotFoundException : "The region manager does not contain the MainRegion region."
But I'm sure that MainRegin is defined and other modules have ad开发者_高级运维ded views in it.
You can always take a look into the source.
RegionCollection implements IEnumarable so you can iterate over the collection or you can
simply use the provided function public bool ContainsRegionWithName(string regionName)
.
精彩评论