title: How can I check the calling command within RowEditEnding in WPF, to be sure I want to execute the event?
body: <p>I have some validation requirements to run within my RowEditEnding event handler. However, there are certain conditions under which those do not run: if the delete button is pressed, if the user goes to a detail form to work with the record, etc.</p>
  
  <p>How can I check the calling command to see if one of the "Exceptions to the rule" is in play before I try to validate the data in the row?</p>
  
  <p>Currently, the pseudo-code looks something like this:</p>
  
  <pre><code>private void resultsGrid_RowEditEnding(object sender, DataGridRowEditEndingEventArgs e)
  {
      if (!allFieldsAreValid)
      {
          e.Cancel = true;
          return;
      }
      return;
  }
  </code></pre>
  
  <p>I would like it to look like this:</p>
  
  <pre><code>private void resultsGrid_RowEditEnding(object sender, DataGridRowEditEndingEventArgs e)
  {
      if ( CommandToDeleteRow || CommandToGoToForm )
          return;
      if (!allFieldsAreValid)
      {
          e.Cancel = true;
          return;
      }
      return;
  }
  </code></pre>
  
  <p>Thanks!</p>