I have a view let's call it 'NestedView', which defines nested region, due to lack of nested region support in XAML I create a view in UserControl constructor like this:
RegionManager.SetRegionName(RegionControl, "MyRegionName");
RegionManager.SetRegionManager(RegionControl, _globalRegionManager);
'NestedView' is shown (added) to some region let's call it 'MainRegion', at some time I need to close this view (remove it from 'MainRegion'). But If I simply remove 'NestedView' from 'MainRegion', the region it has registered 'MyRegionName' will remain registered, and the next time I will try to open 'NestedView' it will throw exception that region 'MeregionName' already registered.
So I need to make sure that when I close view that contain regions, they are unregistered, and all views they contain are disposed. What is the best way to do this?