私はPrismを初めて使い、ElementHost内でPrisimコントロールをホストしようとしています。私は何か非常に基本的なものが欠けているようです。私はElementHostを含む単一のWinFormを持っています。次のコードの形式である:ブートストラップはregisrationElementHost内でのPrisimの使用方法
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;
}
}
を扱う
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
Bootstrapper bootstrapper = new Bootstrapper();
bootstrapper.Run();
var child = bootstrapper.Container.Resolve<Shell>();
elementHost.Child = child;
}
MyView.xamlは、この時点ではラベル以外の何ものでもありません。
<ItemsControl Name="MainRegion" cal:RegionManager.RegionName="MainRegion" />
モジュールコードが最小である:
Shell.xamlには、以下のXAMLを含んでユーザーコントロールである私は理解しようとプリズムコードに深いトレースしてきた
public class MyModule : IModule
{
private readonly IRegionViewRegistry _regionViewRegistry;
public MyModule(IRegionViewRegistry registry)
{
_regionViewRegistry = registry;
}
public void Initialize()
{
_regionViewRegistry.RegisterViewWithRegion("MainRegion", typeof(MyView));
}
}
ビューが決してその地域に設定されない理由私は何か基本的なものを欠いています
あなたは私の一日をします。この興味深いハックも私のために働く:-) –