2

我想从 6.3 更新到 7。

我似乎遇到了障碍。

在 App.xaml 中使用 PrismApplication 类时,CreateShell 期望返回类型为 Window,而不是之前需要 DependencyObject 的 BootStrapper。

我的 MainShell 是一个修改过的 Telerik RadWindow,它本身就是一个修改过的 System.Windows.Controls.HeaderedContentControl,并且无法转换为 Window。

有没有办法解决这个问题,所以我可以使用 PrismApplication 对象,还是我必须像以前一样回滚并使用 BootStrapper?

4

1 回答 1

4

我是否必须像以前一样回滚并使用 BootStrapper?

引导程序仍然存在。它被标记为已弃用,可能会在未来的版本中消失,但只要它存在,您就可以使用它。至少,直到问题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();
}
于 2019-01-24T10:04:38.073 回答