views:

200

answers:

1

I have a SL DataGrid that has two columns. I need to be able to catch any change to the a row and save it into an undo stack. I setup the event RowEditEnded and tried to add to the undo stack there. The problem I'm running into is that I have no way to get the new value from RowEditEnded. If the column is a ComboBox then it updates the binding source before RowEditEnded is thrown, but if I have just a TextBox then RowEditEnded is thrown before the datasource is updated.

Does anyone know of a way to force the DataBinding source to be updated before RowEditEnded to allow me to access the new value when the column is a template column with a textbox?

+1  A: 

You will need to catch the changes in your class that is bound to since that is where the changes are being stored. The DataGrid edit mode is a state of the data grid, not the values behind it.

Bryant
I ended up doing it this way. I find it not very clean and don't really like the way it works, but since I couldn't get the data properly in RowEditEnded, this was the best solution.
Stephan
Personally I think it is probably a cleaner solution. The UI should be tracking changes to the data, the View Model or the Model should be doing that.
Bryant