title: WPF DataGrid - cell's new value after edit ending
body: <p>In my system I need to capture and send the old and new value of a cell edit. I've read that you can do this by inspecting the EditingElement of the event DataGridCellEditEndingEventArgs like this:</p>
  
  <pre><code>    _dataGrid.CellEditEnding += (sender, e) =&gt; {
        var editedTextbox = e.EditingElement as TextBox;
  
        if (editedTextbox != null)
        MessageBox.Show("Value after edit: " + editedTextbox.Text);
  }
  </code></pre>
  
  <p>In my case, the data is a dictionary so the EditingElement is a ContentPresenter </p>
  
  <pre><code>var editedTextbox = e.EditingElement as ContentPresenter;
  if (editedTextbox != null)
    MessageBox.Show("Value after edit: " + editedTextbox.Content);
  </code></pre>
  
  <p>and the Content is the original, not the new edited value.</p>
  
  <p>How can I get this to work:</p>
  
  <pre><code>_dataGrid.SomeEvent(sender, e)-&gt;{
    SendValues(e.oldCellValue, e.newCellValue);
  }
  </code></pre>