InteractionRequest

Feb 8, 2013 at 6:32 AM
Hi List,
in my ShellView and ShellViewModel i would like to define a InteractrionRequest toehter with the according Xaml.
Reason: no code dublication for every popup in my Application.
The neeed UserControls are inserted in the popup like thei
< Contend = myUserControl
What do you think about this and how to comunicate from Module to ShellViewModel to raise the Interaction and get resuöls back.

Thanks
Peter
Developer
Feb 8, 2013 at 4:28 PM
Edited Feb 8, 2013 at 4:28 PM
Hi,

I believe you could benefit from the IInteractionRequest interface and the InteractionRequest<T> class provided by Prism. As this will let you preserve a clean separation between the view model and the view. This way the view model could encapsulate the presentation logic and let the view handle the visual aspects of the interaction. As you may find the Raise method of this class allows you to initiate the interaction and to specify a context object and a callback method that is called after the interaction completes where you could retrieve the different results.

Also, this approach benefits of Microsoft Expression Blend Behaviors that supports the concept of triggers and actions, that are used in the view to bind to this interface and subscribe to the event that it exposes.

As you may find in Silverlight by default, a NotificationChildWindow or ConfirmationChildWindow is displayed based on the context object passed. But you can override this behavior by specifying a pop-up window using the ChildWindow property of the PopupChildWindowAction class in order to display your custom window.

For more detailed information about this approach, I recommend you to check the following resources:
I hope you find this helpful,

Agustin Adami
http://blogs.southworks.net/aadami
Feb 11, 2013 at 6:24 AM
Hi Augustin,

and thanks a lot.
What i'm looking for is a 'SharedService' or stuff like this to make ShellView-ShellViewModel handle all the stuff of Confirmation/Notification for my Application.
Let's say in any of my ViewModles i want to call something like this:

InteractionService (myView,myViewModel,callback);

and have all the plumbing stuff and the Xaml in ShellView and SheelViewModel otherwise i have to polute all my Views with different Xamls to handle Confirmation-Notification's

Hope this make thinks clear
Thanks
Peter
Feb 13, 2013 at 6:32 AM
Hi,
i got it to work.
I make use of EventAggregator and fire an Event with (View,ViewModel,Action), the ShellViewModel catches this Events and show's the View's using InteractionTequest.

Thanks
Peter