1

I'm using Telerik's RadGridView in an MVVM app. In this particular gridview users can add rows and edit them. There's also a separate save button to save the items in the RadGridView.

The problem that I'm experiencing is that when the user inserts a new row, but doesn't press ENTER or ESC to cancel or commit, then clicks on the Save button, the bound collection is in a half-baked state. My preferred behavior would be for the gridview to commit the row edit whenever the user clicks anywhere outside of the row being edited. Is that possible?

kristofvdj88
  • 855
  • 8
  • 12

1 Answers1

1

Turns out it's a simple line of code that can solve this. I eventually was able to solve this myself by placing the following in the event that is triggered when clicking the save button:

gridview.CommitRowEdit(gridview.RowInEditMode);

It takes the current row that's being edited and commits it.

kristofvdj88
  • 855
  • 8
  • 12
  • The edit should be commited on lost focus by default. Maybe you changed the ActionOnLostFocus property of the Radgridview ? : https://docs.telerik.com/devtools/wpf/controls/radgridview/how-to/cancel-edit-on-lost-focus – Ostas Jun 25 '20 at 16:42
  • oddly enough, having ActionOnLostFocus not specified or set as CommitEdit dit not resolve the issue in my case. – kristofvdj88 Jun 25 '20 at 18:24