title: WPF MVVM event to command - invoke command based on event args
body: <p>I have a WPF app which uses DevExpress controls and MVVM with PRISM.
  <br>
  I'm using DockLayoutManager's 'DockOperationCompleted' event to invoke a command on my view model like this:</p>
  
  <pre><code>    &lt;dxd:DockLayoutManager x:Name="dockContainer"&gt;
          &lt;i:Interaction.Triggers&gt;
              &lt;i:EventTrigger EventName="DockOperationCompleted"&gt;
                  &lt;i:InvokeCommandAction Command="{Binding DataContext.SaveLayoutCommand, ElementName=dockContainer}" /&gt;
              &lt;/i:EventTrigger&gt;
          &lt;/i:Interaction.Triggers&gt;
          &lt;dxd:LayoutGroup/&gt;
      &lt;/dxd:DockLayoutManager&gt;
  </code></pre>
  
  <p>The purpose of the 'SaveLayoutCommand' command is to save the layout so it can be restored later in time.
  <br>
  The 'DockOperationCompleted' event is raised after a DockItem gets docked or closed (there are other cases but they are irrelevant).
  <br>
  The problem is that when I close the main window, the dock items in my DockLayoutManager are getting closed one by one and thus 'SaveLayoutCommand' gets invoked for every closed dock item and I don't want this to happen.
  <br>
  The 'DockOperationCompletedEventArgs' with which the event gets raised has a 'DockOperation' property which I can check agains, but I'm not sure where exactly should this code fit in.
  <br>
  What I am trying to achieve is that the command should be invoked only in one case - when the item is docked 
  <br>
  <strong>My question is</strong> : is there a way to 'filter' when the command gets invoked based on the event's event args? <br></p>
  
  <p><strong>Thanks</strong> :)</p>