WPF Datagrid Row Editing "ENDED" event

Viewed 26373

I know that WPF datagrid has "RowEditEnding" event , but I need to fire the event on after the Row has comitted to check if the newly added row is duplicated and merge the duplicated row. My datagrid has "CanUserAddRow" property set to True.

I am using EntityObservableCollection that extends ObservableCollection to synchronize my entity with the collection. So, i considered OnCollectionChanged event, but the "InsertItem" event is raise once user click on the new item place holder row, which means the object is still empty and I cant check for duplicate.

Is there anyway that I can raise the RowEditEnded event?

Thanks...

8 Answers

You can use UpdateSourceTrigger=PropertyChanged on the binding of the property member for the datagrid. This will ensure that when CellEditEnding is fired the update has already been reflected in the observable collection. see this post https://stackoverflow.com/a/27239243/9285072

Maybe you can use the event "CurrentCellChanged". This fires when you start editing a cell too, but maybe you can find a way to not always do everything you want to do in your method.

I had same problem when i wanted to check if the changes in the datagrid are actually changes to the original values. This event is working for my needs.

Hope i could tell you something new.

Related