title: How to set the binding.UpdateSourceTrigger of DataGridTextColumn in AutoGeneratingColumn event of DataGrid
body: <p>I would like to set the UpdateSourceTrigger of a DataGridTextColumn binding to "LostFocus" from the code-behind in the AutoGeneratingColumn event. The default behavior is that the source is only updated when the row loses focus, but I need it to update when the cell loses focus.</p>
  
  <p>Here is my attempt:</p>
  
  <pre><code>    private void DataGrid_AutoGeneratingColumn(object sender, DataGridAutoGeneratingColumnEventArgs e)
      {
              //my attempt to get cell to update on cell lost-focus, rather than row lost-focus
              Binding newBinding = new Binding(e.PropertyName);
              newBinding.UpdateSourceTrigger = UpdateSourceTrigger.LostFocus;
              (e.Column as DataGridTextColumn).Binding = newBinding;
      }
  </code></pre>
  
  <p>This does not seem to be working because the source is still only being updated once the row loses focus.</p>
  
  <p>Note: I am aware this is usually done in the XAML in the column defintion, but I cannot put it there because my columns are being dynamically generated at run-time.</p>