WPF + PRISM - show modal popup window with controls in it?

Topics: Prism v4 - WPF 4
Aug 5, 2012 at 12:10 PM

I am following the 'Stock Trader RI' example by the Prism team, but it does not address this exactly :

I have a Shell with a Main Region in it.

In this shell I have some filter fields and a grid.

When I press on a button - I would like to load a screen that allows me to change the filters,

and then press 'Save'. This would then call a service to update the fields, and close the pop-up.

Here is an illustration of the 'Shell' before pressing the button (left) and after (right) :

Illustration :

Illustration :

Problems are :

  1. The 'Stock Trader RI' sample app only uses a modaless dialog popup. I need a MODAL pop-up (background will continue to refresh, but user will not have access to it as long as pop-up is active).
  2. Need to have Silverlight-like effect when pop-up shows, meaning - 'Shell' needs to appear 'disabled' (like a gray mask over it).
  3. Pop-up window should have no 'X' button and no 'minimize' or 'maximize' buttons. The pop-up window should be simply a rectangle with curved-corners.
  4. I don't think I can use a 'Notification Window' or a 'Confirmation Window' because I cannot put inside them whatever I want. This is an example with 2 fields, but the pop-up might be much more complex with tabs, and a lot of information shown to the user.

So how do I show a modal pop-up from my "WPF+PRISM" Shell-View-Model once the 'Edit' button is pressed ? (Meaning, once the 'EditCommand' is executed...)

Aug 6, 2012 at 7:02 PM
Edited Aug 6, 2012 at 7:06 PM


I believe you could benefit from using Interaction Requests to achieve this kind of scenarios. Take into account that, different triggers and actions can be defined to support custom interaction mechanisms. By default Prism only provides the InteractionRequestTrigger and PopupChildWindowAction implementations that can be used as a basis for the development of your own triggers and actions, this way you could create your own implementation to show your custom popup views.

For example, you could check the custom TriggerAction implementation provided by Karl Shifflett in his In the Box - MVVM Training (MVVM Scenarios section), which allows showing an overlay UI dialog for notifications. In my opinion this could be an useful starting point to achieve the scenario you mentioned.

Take into account that when raising an interaction request the context parameter passed will be set as the data context of the view displayed, and once the popup is closed, this context is passed back to the view model, along with any updated values, via the callback method. This could be useful to send and receive information from your pop up views.

For more information about the use of Interaction Requests you could check the following section of the Prism documentation at MSDN:

Also, for additional examples using Interaction Requests and custom TriggerAction implementations in WPF, I believe you could find the following blog post by Damian Cherubini interesting:

I hope you find this handy,

Agustin Adami