I'm using Prism in a ViewModel first approach, i.e.:
1) I register my ViewModels in a container (unity in this case) .
2) I supply a DataTemplate (UserControl) for each vm .
3) I navigate using the ViewModel name which I registered with the Container .
_regionManager.RequestNavigate(regionName, viewModelName, navigationCallBack);
This works fine , but when I attempt to remove the "View" from this region, I get the following exception :
The region does not contain the specified view. Parameter name: view
I attempt to remove:
var region = _regionManager.Regions[requests[i].RegionName];
var view = region.Views.Single(v => v.GetType().Name == requests[i].ViewName);
region.Remove(view);
The ViewModel is found in the "Views" collection. Any idea what is wrong and how to work around this?