I have a problem that I seem to be unable to solve. I created a test project using MEF and Prism4. I created a test project in which I have 2 views, and each of them is registered inside the region, as well as a button in another region. When the button is pressed, I want the view of the change to be correct. The code that I consider to be incorrect is below, who has ideas, what am I doing wrong here?
public void Initialize()
{
regionManager.RegisterViewWithRegion(RegionNames.MainRegion, typeof(Views.Module1View));
Button button = new Button() { Content = "Module1" };
button.Click += (o, i) =>
{
var region = this.regionManager.Regions[RegionNames.MainRegion];
if (region != null)
{
region.Activate(typeof(Views.Module1View));
}
};
regionManager.AddToRegion(RegionNames.NavigationRegion, button);
}
I get the following error ...
The region does not contain the specified view.
Parameter name: view
source
share