Advertisement
Guest User

Untitled

a guest
Jun 27th, 2019
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. class EditableDataGrid : DataGrid
  2. {
  3. protected override void OnCanExecuteBeginEdit(CanExecuteRoutedEventArgs e)
  4. {
  5. e.CanExecute = true;
  6. e.Handled = true;
  7. }
  8. }
  9.  
  10. protected override void OnExecutedCommitEdit(ExecutedRoutedEventArgs e)
  11. {
  12. base.OnExecutedCommitEdit(e);
  13. if (e.Parameter is DataGridEditingUnit unit && unit == DataGridEditingUnit.Cell)
  14. {
  15. CancelEdit(unit);
  16. }
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement