WPF DataGrid not exiting edit mode

You can try to force datagrid into cancelling edition when you need it:

myDatagrid.CommitEdit(); 
myDatagrid.CancelEdit();

This worked for me, i had a similar issue when reordering rows.


This is a bug that was fixed with .NET Framework 4.5+. Unfortunately, for those of us stuck with previous versions the error is still a problem. The best solution I have found is to simply bind the DataGrid to properties with type string. That way, full control over user input is available. With full control, the user should not be able to trigger any errors, and theDataGrid will not crash the program.