Thursday, October 23, 2014

PopUps with Interactivity using ConfirmationRequest [Prism 5.0]

In continuation to my previous blog on PopUps with Interactivity, here we will see how to implement IConfirmation request. In order to make this post short, I'll implement IConfirmation request on top of previous example. 

Let's open our viewModel and add property for InteractionRequest of type IConfirmation  as:

public InteractionRequest<IConfirmation> ConfirmationRequest { get; set; }

Now for every getter/setter we should have a corresponding command, which will help us in invoking this request:

public ICommand ConfirmationCommand { get; set; }

Just like NotificationRequest, we need to create instances of these objects in constructor as:

If you will see above snippet closely, you will notice that in case of Confirmation, we are handling Status in slight different manner.

Next step is to update our View as we did for NotificationRequest.

Now everything is in place. Let's quickly run the application and click on PopUp button:

Based on user's choice, whether OK or Cancel button is clicked, status message will be displayed as shown:

Hope you understood the use of ConfirmationRequest. 

No comments:

Post a Comment