0
votes

I would like to write a multi-window WPF application using Prism 7.1 with Unity. The main window is supposed to host some buttons, each of which opens a new window.

Is there a built-in way in Prism/Unity that will open/create a window only once and not create new instances when the users clicks the button multiple times? When the user closes the window, a click on the corresponding button in the main window shall then again create a new instance of the window.

I understood that view-based navigation allows for navigating to an existing view (which basically does the trick on view level). But views are injected into regions, regions are defined in a shell and to my understanding a shell is a top level window. So how can I navigate from one shell to a new one?

1

1 Answers

0
votes

Is there a built-in way in Prism/Unity that will open/create a window only once and not create new instances when the users clicks the button multiple times?

No, because neither of them provides any means to open or create windows in the first place.

That being said, creating a service that creates a new window and does nothing when called again is trivial. Register that service as a singleton, inject it into your view models and you're done.