title: Prism Custom Confirmation Interaction
body: <p>I created a custom confirmation window in an app with Prism Unity, WPF &amp; Mvvm.  I need help with the notifications that need to be sent back to the viewmodel. I have this in the detail record view, let's call it MyDetailView.</p>
  
  <pre><code>&lt;!-- Custom Confirmation Window --&gt;
  &lt;ie:Interaction.Triggers&gt;
    &lt;interactionRequest:InteractionRequestTrigger 
         SourceObject="{Binding ConfirmationRequest, Mode=TwoWay}"&gt;
       &lt;mycontrols:PopupWindowAction1 IsModal="True"/&gt;
    &lt;/interactionRequest:InteractionRequestTrigger&gt;
  &lt;/ie:Interaction.Triggers&gt;
  </code></pre>
  
  <p>As shown above, I made the interaction Mode=TwoWay so that the confirmation popup window can send back the button click result for the OK or Cancel button.  The confirmation window appears as it should, but I don't know how to send the button click result back to my viewmodel, say MyDetailViewModel.  That is the main question.</p>
  
  <p>EDIT:  This is MyDetailViewMmodel method that raises the InteractionRequest.</p>
  
  <pre><code>private void RaiseConfirmation()
  {ConfirmationRequest
      .Raise(new Confirmation()
      {
          Title = "Confirmation Popup",
          Content = "Save Changes?"
      },  c =&gt;{if (c.Confirmed)
  { UoW.AdrTypeRos.Submit();}
  </code></pre>
  
  <p>This is the PopupWindowAction1 class.  Part of the answer to the question may be how do I implement the Notification and FinishedInteraction methods.</p>
  
  <pre><code>class PopupWindowAction1 : PopupWindowAction, IInteractionRequestAware
  {
      protected override Window GetWindow(INotification notification)
      { // custom metrowindow using mahapps
          MetroWindow wrapperWindow = new ConfirmWindow1();
          wrapperWindow.DataContext = notification;
          wrapperWindow.Title = notification.Title;
  
          this.PrepareContentForWindow(notification, wrapperWindow);
  
          return wrapperWindow;
      }
  
      public INotification Notification
      {
          get { throw new NotImplementedException(); }
          set { throw new NotImplementedException(); }
      }
  
      public Action FinishInteraction
      {
          get { throw new NotImplementedException(); }
          set { throw new NotImplementedException(); }
      }
  }
  </code></pre>
  
  <p>Is there some interaction I need to put in my ConfirmWindow1, something like this?</p>
  
  <pre><code>&lt;i:Interaction.Triggers&gt;
    &lt;i:EventTrigger EventName="PreviewMouseLeftButtonUp"&gt;
      &lt;ei:CallMethodAction 
        TargetObject="{Binding RelativeSource={RelativeSource AncestorType=UserControl}, 
          Path=DataContext}"
        MethodName="DataContext.ValidateConfirm"/&gt;
    &lt;/i:EventTrigger&gt;
  &lt;/i:Interaction.Triggers&gt;
  </code></pre>
  
  <p>Do I even need to do that type of interaction within the button?  If so, how do I code it needs so that it corresponds to the particular viewmodel that invoked the interaction.  Any suggestions?  Thank you.</p>