title: WPF DataGrid - How to automatically exit Edit Mode?
body: <p>I have implemented WPF DataGrid <a href="http://wpf.codeplex.com/wikipage?title=Single-Click%20Editing" rel="noreferrer">Single-Click Editing</a> from Codeplex. 
  In that solution, the clicked cell is focused and the row is selected to achieve
  single-click editing of DataGrid. It worked great.</p>
  
  <p>Here's the code:</p>
  
  <pre><code>private void DataGridCell_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
      {
          DataGridCell cell = sender as DataGridCell;
          if (cell != null &amp;&amp; !cell.IsEditing &amp;&amp; !cell.IsReadOnly)
          {
              if (!cell.IsFocused)
              {
                  cell.Focus();
              }
              DataGrid dataGrid = FindVisualParent&lt;DataGrid&gt;(cell);
              if (dataGrid != null)
              {
                  if (dataGrid.SelectionUnit != DataGridSelectionUnit.FullRow)
                  {
                      if (!cell.IsSelected)
                          cell.IsSelected = true;
                  }
                  else
                  {
                      DataGridRow row = FindVisualParent&lt;DataGridRow&gt;(cell);
                      if (row != null &amp;&amp; !row.IsSelected)
                      {
                          row.IsSelected = true;
                      }
                  }
              }
          }
      }    
  </code></pre>
  
  <p>But I also want my DataGrid to automatically exit editing mode (without hitting Enter key)
  when a cell value is changed. For example, I have a combobox in the cell when in edit mode. When user selects a value in combobox, it will automatically databind the selected value. But then the user still need to click Enter to exit edit mode. How can I exit edit mode automatically? </p>
  
  <p>I've tried listening for property changes and call CommitEdit function of DataGrid to exit edit mode automatically. Works great and here's the code:</p>
  
  <pre><code> void _gameCompareViewModel_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
      {
          if (e.PropertyName == "End Edit")
          {
              AlignGrid.CommitEdit();
          }
  
      }
  </code></pre>
  
  <p>But now the Single-Click editing feature will not work for the current cell.
  I have to click a different row first in order for it to work.
  I think what I want is when CommmitEdit is called, it automatically selects a 
  different row. (Like when you hit Enter, it will go to the next row)
  Any suggestions guys? Please show me codes on how to do this. Im running out of time here for my project.</p>
  
  <p>Thanks for the help. </p>