R
ryanbreakspear
Hi,
I have a WPF datagrid bound to a List<CustomObject>. The object
implements INotifyPropertyChanged & IEditableObject.
When a row in the datagrid has been updated I want to write the
changes to the database. I also need to audit the changes made, so
want access to the old and new properties. Using the RowEditEnding
event, the values of the object are still the old ones (I need the new
values as I already have a reference to the old ones). I can access
the new values using the EditingElement in the CellEditEnding event,
but I want to do this at a row level, and don't want to have to write
code for each column.
I can change the behaviour of the RowEditEnding, either by setting the
UpdateSourceTrigger=PropertyChanged on the binding, or by calling
DataGrid.CommitEdit, but both of these remove the ability to cancel
the edit if an error occurs.
Basically I want access to old and new values, and choose whether to
Commit or Cancel changes. Any ideas would be appreciated.
Thanks in advance
Ryan
I have a WPF datagrid bound to a List<CustomObject>. The object
implements INotifyPropertyChanged & IEditableObject.
When a row in the datagrid has been updated I want to write the
changes to the database. I also need to audit the changes made, so
want access to the old and new properties. Using the RowEditEnding
event, the values of the object are still the old ones (I need the new
values as I already have a reference to the old ones). I can access
the new values using the EditingElement in the CellEditEnding event,
but I want to do this at a row level, and don't want to have to write
code for each column.
I can change the behaviour of the RowEditEnding, either by setting the
UpdateSourceTrigger=PropertyChanged on the binding, or by calling
DataGrid.CommitEdit, but both of these remove the ability to cancel
the edit if an error occurs.
Basically I want access to old and new values, and choose whether to
Commit or Cancel changes. Any ideas would be appreciated.
Thanks in advance
Ryan