WPF Prism: Problem with creating a Shell

核能气质少年 提交于 2019-12-22 11:28:40

问题


I just started learning Prism and trying to use it with MEF in a test WPF application.
Based on "WPF Hands-On Lab: Get Started with the Prism Library" example in the Prism4 documentation, in a test WPF project I renamed MainWindow class to Shell.
My Bootstrapper class has the following code (also based on the Lab example):

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 code:

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

When I try to run the app even without exporting any module in it, I get an error:
"Cannot locate resource 'mainwindow.xaml'."

What am I doing wrong?


回答1:


When you renamed your class did mainwindow.xaml get renamed to shell.xaml?

But the code/config is still pointing to the original name.



来源:https://stackoverflow.com/questions/4996751/wpf-prism-problem-with-creating-a-shell

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!