解決できないような問題があります。MEFとPrism4を使用してテストプロジェクトを作成しました。2つのビューがあり、それぞれがリージョン内に登録され、別のリージョンにボタンが登録されているテストプロジェクトを作成しました。ボタンがクリックされたとき、私は正しいビューに変更のビューが欲しいです。私が間違っていると思うコードは以下のとおりです、誰かが私がここで間違っていることについて何か考えを持っていますか?
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);
}
次のエラーが発生します...
The region does not contain the specified view.
Parameter name: view