InteractionRequest in WPF application

Topics: Prism v4 - WPF 4
Dec 1, 2010 at 6:44 PM


I am trying to implement the InteractionRequest pattern in a Prism v4 WPF application following what described in the documentation but I am not succeeding.

All demo applications are related to Silverlight so my question is: Is this pattern available only in a SL application?

If not, where can I find a sample on how to implement this in WPF?



Dec 1, 2010 at 8:01 PM

Hi Antonio,

There is not guidance on this topic for WPF in Prism out-of-the-box. But I think that you can find the following blog post in the Brian Noyes' Blog:

  • Prompting the User From a View Model–Prism 4 Gems, from this post: All of this applies to the WPF side of the house as well other than the PopupChildWindowAction. That is only in Prism for Silverlight, although it would be a simple matter to migrate the code to WPF. I’ll save that for a future post.

If you continue experiencing this in your scenario, could you please provide more information about your situation or if you are receiving an exception?

Hope this helps.

Fernando Antivero

Dec 2, 2010 at 12:16 AM
Edited Dec 2, 2010 at 6:05 AM

Hi Fernando,

The issue I am having is related to how to display a child window if the PopupChildWindowAction is not available in WPF.

I am using the following Xaml as per the documentation but I get the error saying that PopupChildWindowAction doesn't exist.

        <DataTemplate x:Key="NotifyWindowTemplate">
            <Grid MinWidth="250" MinHeight="100">
                <TextBlock TextWrapping="Wrap" Grid.Row="0" Text="{Binding Message}"/>

        <prism:InteractionRequestTrigger SourceObject="{Binding NotifyInteractionRequest}">
            <prism:PopupChildWindowAction ContentTemplate="{StaticResource NotifyWindowTemplate}"/>

How can I adapt it to work with WPF?



Dec 2, 2010 at 3:50 AM


This is one of those things that you would have to design a dialog window yourself.   Since in WPF there is no implementation of "ChildWindow", precisely why my gripe with some of examples that were developed for this latest release of PRISM alienates a good portion of the developers to have to go and re-write the wheel to make something that should be in box.  Done for one, should be done for the other.  Side by side development has been sort of left out in this case. 

Now in answer there is a gentleman that put together a library full of goodies for WPFer's, located @ that has some of the stuff you might be looking for.  In my honest opinion they guys at P&P have dropped the ball on some of the development tasks that should have been INCLUDED in the Prism release.


Dec 13, 2010 at 7:39 PM


I've written a WPF version of the Interaction Request for my the Box MVVM Training here:

Install this Visual Studio Extension.

Create a new project with the MVVM Training Template.

Check out DialogInteractionRequestView.xaml and its implementation.



May 13, 2011 at 2:09 PM

Hello everyone,


I have extracted the required files from Karl's MVVM training kit to raise the Interaction popup from the View Model.  It all works perfectly fine, however for some reason the Popup with the message appears on the screen as a non-modal window, despite the background turning grey.

The datagrid rows are still active and the user can move around with the keyboard, only mouse interactions seem to be blocked, which isn't good enough.  Is there any way to make the popup truly modal so that nothing works until the user has clicked on OK button?

high appreciated your help on this,


Jan 12, 2012 at 10:09 AM

I built my own PopupChildWindowAction for WPF and it works fine. Usage is exactly same as in silverlight.

Apr 25, 2012 at 4:51 PM

can you share the code your wrote please?

May 9, 2012 at 3:07 PM


For those interested in this subject, I believe you could also find the following blog post interesting:

There you can find a sample with a custom TriggerAction<FrameworkElement> similar to the default PopupChildWindowAction implementation provided by Prism, used in a WPF application.


Agustin Adami

May 13, 2012 at 3:17 PM
Edited May 13, 2012 at 3:18 PM

Thank you, aadami, for the great posting "Prism: InteractionRequest and PopupModalWindowAction for WPF applications". I have a question regarding the popup child window's startup location. Is there a way to place the popup window at the center of the calling window?

May 13, 2012 at 6:42 PM

It is a great post indeed. 

Can you share how I need to modify the code if I want to use the popup modal window as add/edit screen for records in my application.  Basically, I would like when I call the popup window to set the view & View model.  Assume, I have an orders and products modules, in each module I want to use the popup window for the user to edit a single order line or a single product. 

How can I accomplish this by using a common popup window framework?

Thanks again.

May 14, 2012 at 4:46 PM

m5168, I think the issue is that the window does not have an owner set in it, so no matter what you set the WindowStartupLocation it will not work, since the Owner = null.

I am not sure how we would handle that.   But maybe aadami will give us some direction soon.

May 14, 2012 at 5:40 PM


I'm glad you found the post useful. Regarding how you can place the popup window at the center of the parent window using the aforementioned approach, I believe this could be achieved by manually setting the corresponding Owner of the dialog window and its WindowStartupLocation property to "CenterOwner".

An example of this could be modifying the Invoke method of the PopupModalWindowActionBase class like in the following code snippet, by setting the MainWindow as the Owner of the dialog window:

protected override void Invoke(object parameter)
            childWindow.WindowStartupLocation = WindowStartupLocation.CenterOwner;
            childWindow.Owner = Application.Current.MainWindow;

Regarding the scenario described by BishMan, I also believe that the approach suggested by Damian Cherubini in this thread might be more suitable for it.


Agustin Adami

May 20, 2012 at 11:08 PM
Edited May 20, 2012 at 11:09 PM


I am running into a scenario that I can not figure out how to solve.   I am using post as my starting point.  I want to have non-linear navigation in my application.  I am able to get this working no problem.  I created a popup region  and I am able to get the window to load with the view & ViewModel. 

What I am struggling with, if I have 2 modules, and in Module One I created a child window, I want to be able to navigate away from the Module One and move to Module Two and launch another child window, I want to be able to switch back and forth between the module and see both child windows still up.  I also would like to be able to center each child window on the module it belongs to not the entire application, and have something like the behavior of child windows in Silverlight where the background are "covered" with the gray layer, if that makes sense.

How can you accomplish that?



May 21, 2012 at 8:43 PM


If I understood your scenario correctly, you have two views (for example, View1 and View2) in the same region from different modules which can inject their own child views (for example, ChildView1 and ChildView2) in a popup region. You want to be able to navigate between View1 and View2 so that if the child views were injected in the corresponding region, when you navigate to a view you would also see its corresponding popup view. For example, if you navigate to View1 you would also see its ChildView1 (but not ChildView2) and when you navigate to View2 you would also see its ChildView2 (but not ChildView1).

As far as I know, the aforementioned functionality is not implemented in Prism as out of the box. Therefore, you will need to define your own custom logic to handle this scenario.

As a starting point, I believe you could find the INavigationAware interface provided by Prism useful. For example, each of your views (View1 and View2) or their view models could implement the aforementioned interface. When a child view is injected in the popup region, you could save a "state" (popup shown / popup not shown) and the instance of that view in its "parent" view / view model (View1 for ChildView1 and View2 for ChildView2). Then, in the OnNavigatedFrom method of each view (View1 and View2) you can remove the child view from the popup region and in the OnNavigatedTo method, if the aforementioned "state" is that the popup was being shown, you could inject the aforementioned instance of the child view in the popup region again.

Summarizing, you could remove the corresponding child view from the popup region in the OnNavigatedFrom method and inject it again in the OnNavigatedTo method of each view.

Regarding the functionality of "disabling" only the "parent" view of the child window instead of "disabling" the entire application, a possible approach could be to modify the DialogActivationBehavior. By default, the DialogActivationBehavior implements a property named HostControl which references the control where the popup region was defined. For example, if the popup region was defined in the Shell, the HostControl property of the DialogActivationBehavior for that region will be the Shell.

Taking this into account, each of your views could define their own popup region (for example, View1 could defined a PopupRegion1 where it will inject the ChildView1, etc. ), so that when the child view is injected in the corresponding popup region the corresponding "parent" view will be accessible in the DialogActivationBehavior through the HostControl property. For example, if your View1 defines a PopupRegion1 where you inject the ChildView1, the HostControl property will be View1.

Therefore, when a child view is injected in their corresponding popup window, you would be able to access its "parent" and perform the corresponding actions (for example, setting its IsEnable property to false, etc). As at this point you would be able to access the child view, the parent view and the window, how to implement the rest of your requisites like covering the parent view with a gray layer or center the window's position on top of the parent view is mostly related to WPF; and therefore I believe you might find better support for those topics in the WPF forums:

I hope you find this useful,

Damian Cherubini

May 23, 2012 at 2:22 PM

DCherubini & aadami,

Thank you so much for your response but I am not sure I explained my self fully.  What I am trying to accomplish is similar to what aadami posted on his blog

But the problem I am running into is similar to the "Additional Considerations" that aadami posted on May 15, 2012.   I want to be able to open 2 custom dialogs from 2 different modules at the same time.   

Although I understand what you are saying in in your post DCherubini I am thinking there might be an easier more extensible option and I was hoping you guys can give me some direction or a better solution to trying to get 2 custom dialogs to open from 2 different modules at the sametime in PRISM MVVM WPF UNITY application.

Thank you so much for your time and support which is excellent.



May 24, 2012 at 5:31 PM
Edited May 24, 2012 at 5:50 PM


Sorry, it seems that I have misunderstood your scenario. I thought you wanted to have two different popups but only show the one corresponding to the active view (that is, not the two at the same time.) If you want to show two popups at the same time this can be done for example using the aforementioned RegionPopupBehavior simply by defining two different regions, one in each view like mentioned before. Like this, each popup will be independent of each other.

As it seems that you have created a new thread regarding this topic, I believe it would be helpful to continue the discussion in that thread:

Regarding the main topic discussed in this thread about InteractionRequest in WPF you could check the following blog post which provides an implementation based on Agustin's PopupModalWindowAction, as it provides a workaround for the "additional considerations" he mentioned as well as new features which I believe you might find interesting:

I hope you find it useful,

Damian Cherubini

May 24, 2012 at 5:48 PM

Thank you so much, yes I created a new discussion to limit the topic we are discussing.  As you can tell from the post in the "Open 2 message boxes from 2 differnt modules at the same time", I included a project that has the issue I am running into it.  I hope you find that helpful in trying to guide me through a solution.