title: Modifying DataGrid cell values on CellEditEnding event
body: <p>I've been trying to change a different cell value in same row inside CellEditEnding eventhandler in WPF DataGrid control. </p>
  
  <p>If I edit the cell value in an existing row, it works as expected. However, when adding a new row, the change is not reflected to UI if another cell value is clicked by mouse without going into edit mode.</p>
  
  <p>Moving focus to next cell by pressing tab also works as expected, but shouldn't it work for clicking aswell?</p>
  
  <pre><code>public MainWindow()
  {
      InitializeComponent();
  
      DataTable dataTable = new DataTable();
      dataTable.Columns.Add(new DataColumn());
      dataTable.Columns.Add(new DataColumn());
      DataRow existingRow = dataTable.NewRow();
      dataTable.Rows.Add(existingRow);
  
      this.MyDataGrid.ItemsSource = dataTable.DefaultView;
      this.MyDataGrid.CellEditEnding += MyDataGrid_CellEditEnding;
  }
  
  void MyDataGrid_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e)
  {
      (e.Row.Item as DataRowView).Row[1] = "a string that should be displayed immediatly";
  }
  </code></pre>
  
  <p>So far I've tried to change binding UpdateSourceTrigger, NotifyOnSourceUpdated and NotifyOnTargetUpdated but nothing seems to work. I've also tried to do according fixing by reading related topics : <a href="http://codefluff.blogspot.fi/2010/05/commiting-bound-cell-changes.html" rel="nofollow noreferrer">http://codefluff.blogspot.fi/2010/05/commiting-bound-cell-changes.html</a></p>
  
  <p>But those doesn't seem to help either..</p>
  
  <p>One way that I've found to be working is following snippet:</p>
  
  <pre><code>var frameworkElement = this.MyDataGrid.Columns[1].GetCellContent(e.Row);
  frameworkElement.SetValue(TextBlock.TextProperty, "a string that should be displayed immediatly");
  </code></pre>
  
  <p>but I wouldn't want to do dependency on dependencyproperties as I might not know the underlying display type.</p>
  
  <p>So the question is that what could I do to achieve UI updation in new rows as it works with existing rows without using the provided second code snippet? I feel I am missing something..</p>
  
  <p>Edit : Using ClipboardPaste will also work for setting new value but the original edited value will be lost for some reason.</p>
  
  <p>Edit2 : The xaml is currently plain DataGrid, I've tried to do columns and their bindings manually but as I haven't got them to work I've removed them to keep the example code simple</p>
  
  <pre><code>&lt;DataGrid x:Name="MyDataGrid" /&gt;
  </code></pre>
  
  <p>Edit3 : Added this image to describe the problem better. So after clicking next cell I would like the text to be displayed
  <a href="https://i.stack.imgur.com/Wbhc3.jpg" rel="nofollow noreferrer">Example image of the problem</a></p>
  
  <p>Edit4 : Using snoop to view the cell seems to set the element visible, also calling .UpdateTarget(); for the binding seems to help, but it's not working automaticly. Still wondering what is the cause..</p>
  
  <p>Edit5: I would like this to work with DataTable as I need it's other features</p>