繁体   English   中英

WPF Prism:创建外壳的问题

[英]WPF Prism: Problem with creating a Shell

我刚刚开始学习Prism,并尝试在测试WPF应用程序中将其与MEF一起使用。
基于Prism4文档中的“ WPF动手实验:Prism库入门”示例,在一个测试WPF项目中,我将MainWindow类重命名为Shell
我的Bootstrapper类具有以下代码(也基于Lab示例):

class Bootstrapper : MefBootstrapper
{
    protected override DependencyObject CreateShell()
    {
         return new Shell();
    }

    protected override void InitializeShell()
    {
        Application.Current.MainWindow = (Shell)this.Shell;
        Application.Current.MainWindow.Show();
    }
    ...

App.xaml.cs代码:

public partial class App : Application
{
    protected override void OnStartup(StartupEventArgs e)
    {
        base.OnStartup(e);
        Bootstrapper bootstrapper = new Bootstrapper();
        bootstrapper.Run();
    }
}

当我尝试运行该应用程序时甚至未导出任何模块时,都会收到错误消息:
“无法找到资源'mainwindow.xaml'。”

我究竟做错了什么?

重命名类时,mainwindow.xaml是否重命名为shell.xaml?

但是代码/配置仍指向原始名称。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM