Prism は初めてで、ElementHost 内で Prisim コントロールをホストしようとしています。非常に基本的なものが欠けているようです。ElementHost を含む単一の WinForm があります。次のコードは次の形式です。
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
Bootstrapper bootstrapper = new Bootstrapper();
bootstrapper.Run();
var child = bootstrapper.Container.Resolve<Shell>();
elementHost.Child = child;
}
BootStrapper は登録を処理します
public class Bootstrapper : UnityBootstrapper
{
protected override DependencyObject CreateShell()
{
Container.RegisterType<MyView>();
var shell = Container.Resolve<Shell>();
return shell;
}
protected override IModuleCatalog GetModuleCatalog()
{
ModuleCatalog catalog = new ModuleCatalog();
catalog.AddModule(typeof(MyModule));
return catalog;
}
}
この時点では、MyView.xaml は単なるラベルにすぎません。
Shell.xaml は、次の XAML を含む UserControl です。
<ItemsControl Name="MainRegion" cal:RegionManager.RegionName="MainRegion" />
モジュール コードは最小限です。
public class MyModule : IModule
{
private readonly IRegionViewRegistry _regionViewRegistry;
public MyModule(IRegionViewRegistry registry)
{
_regionViewRegistry = registry;
}
public void Initialize()
{
_regionViewRegistry.RegisterViewWithRegion("MainRegion", typeof(MyView));
}
}
View がリージョンに設定されない理由を突き止めようとして、Prism コードを深く調べてきました。基本的なものが欠けていますか?