Raising InteractionRequest when CompositeCommand fired

Topics: Prism v4 - WPF 4
Oct 12, 2015 at 3:37 PM

I have a scenario where I have multiple views registered in a window with one view active at a time.

I am using a CompositeCommand when the window is closing to validate the close can occur, with each view registering a command with that composite command.

The composite command works as expected, but my problem is that some of the views need to raise an interaction request to allow the user to confirm they want the window to close without fixing validation issues on those views.

To do this some of the views have interaction requests which they trigger when their command fires and then need user confirmation.

The issue that I'm having is that if the view isn't the currently active view then the interactionrequest cannot fire as either the Raised event becomes null or an exception of "This Visual is not connected to a PresentationSource" is thrown.

I have tried to implement an activation of the view that wants to raise an interaction request but because the composite command is executing synchronously the view cannot be activated before the interaction request needs to fire.

Am I going about implementing this wrong? Or getting the interaction request to not throw?