Prism 7. 将 PrismApplication.CreateShell() 与非 Window 控件一起使用
Prism 7. Using PrismApplication.CreateShell() with a non Window control
我想从 6.3 更新到 7。
我好像遇到了障碍。
在 App.xaml 中使用 PrismApplication class 时,CreateShell 需要 return 类型的 Window 而不是之前需要 DependencyObject 的 BootStrapper。
我的 MainShell 是一个修改过的 Telerik RadWindow,它本身是一个修改过的 System.Windows.Controls.HeaderedContentControl 并且无法转换为 Window。
是否有解决此问题的方法,以便我可以使用 PrismApplication 对象,或者我是否必须回滚并像以前一样使用 BootStrapper?
do I have to roll back and use the BootStrapper like before?
引导程序仍然存在。它被标记为已弃用,可能会在未来的版本中消失,但只要它存在,您就可以使用它。 至少,直到 PrismApplicationBase
的问题得到解决。您应该为此在 github 上创建一个问题。
编辑:
问题已经提出,不会修复 (1413)。
我将从问题中复制建议的解决方法以供参考:
protected override Window CreateShell()
{
return null;
}
protected override void OnInitialized()
{
var shellWindow = Container.Resolve<ShellWindow>();
shellWindow.Show();
MainWindow = shellWindow.ParentOfType<Window>();
// there lines was not executed because of null Shell - so must duplicate here. Originally called from PrismApplicationBase.Initialize
RegionManager.SetRegionManager(MainWindow, Container.Resolve<IRegionManager>());
RegionManager.UpdateRegions();
InitializeModules();
base.OnInitialized();
}
我想从 6.3 更新到 7。
我好像遇到了障碍。
在 App.xaml 中使用 PrismApplication class 时,CreateShell 需要 return 类型的 Window 而不是之前需要 DependencyObject 的 BootStrapper。
我的 MainShell 是一个修改过的 Telerik RadWindow,它本身是一个修改过的 System.Windows.Controls.HeaderedContentControl 并且无法转换为 Window。
是否有解决此问题的方法,以便我可以使用 PrismApplication 对象,或者我是否必须回滚并像以前一样使用 BootStrapper?
do I have to roll back and use the BootStrapper like before?
引导程序仍然存在。它被标记为已弃用,可能会在未来的版本中消失,但只要它存在,您就可以使用它。 至少,直到 PrismApplicationBase
的问题得到解决。您应该为此在 github 上创建一个问题。
编辑:
问题已经提出,不会修复 (1413)。
我将从问题中复制建议的解决方法以供参考:
protected override Window CreateShell()
{
return null;
}
protected override void OnInitialized()
{
var shellWindow = Container.Resolve<ShellWindow>();
shellWindow.Show();
MainWindow = shellWindow.ParentOfType<Window>();
// there lines was not executed because of null Shell - so must duplicate here. Originally called from PrismApplicationBase.Initialize
RegionManager.SetRegionManager(MainWindow, Container.Resolve<IRegionManager>());
RegionManager.UpdateRegions();
InitializeModules();
base.OnInitialized();
}