开发者

WPF Prism: Problem with creating a Shell

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?


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

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜