Search code examples
c#wpfxamlprism

How do I open a Prism window from a non-prism WPF project?


I'm working on a big WPF project without Prism library. Now I received a new small project that uses Prism and consists in a couple of views only (MainWindow and a dialog). Is there a way to import it in my solution as a new assembly and launch its MainWindow clicking a button from my non-prism project part?


Solution

  • This won't work unless the small project uses the (prematurely deprecated) bootstrapper.

    To configure the container and create the initial window, Prism nowadays uses a custom System.Windows.App-derived type. There can only be one instance of these in any app-domain.

    You can go for a separate process or a separate app-domain or a refactoring to introduce your own bootstrapper.

    If you had a bootstrapper, all you needed to do was new MyBootstrapper().Run();