WPF Datagrid Row Edit Cancel

Nov 18, 2008 at 5:40 AM
I have a problem with new WPF datagrid....
i can edit the cells of the existing row but how can i get that whole row back when i cancel the edit...
Is this possible to get row back??
i can get the cell value back when i press Ecs but i dont know how to do it with whole row....
Nov 18, 2008 at 9:23 AM
Hi,

Yes, this is possible. I am guessing you are binding to your own objects? if so, in order to provide this functionality you have to implement the IEditableObject interface:

http://msdn.microsoft.com/en-us/library/system.componentmodel.ieditableobject.aspx

See this blog post for a generic technique for implementing this interface:

http://blogs.infragistics.com/blogs/joshs/archive/2008/05/08/creating-objects-that-support-edit-cancellation-via-ieditableobject.aspx

You get this functionality for free if you bind to a DataTable because DataRowView implements this interface.

Regards,
Colin E.