Is there a way to enable undo of deleting a row in a grid? I searched for classes related to undo/redo
and only thing I could find is ActionHistory from WPF library.
Thanks
As I mention in this thread, the grid does not maintain a list of deleted or modified rows, so it would be up to the underlying DataSource to maintain the list of deleted rows and undo the deletion. In the case of the DataTable, this logic already exists, as mentioned. Another option might be to maintain the list of deleted rows from the DataSource yourself in a stack (i.e. maintain your own history) and re-add them to the data source if you need to undo the deletion.
-Matt
The difficulty is integrating the undo along side of UltraGrid's regular undo stack. I can maintain the deleted
data in my own stack. But when a user press Ctrl-Z to undo, how can I tell it's my turn to undo vs UltraGrid's
turn? Only way to achieve that is somehow to add to UltraGrid's undo stack. But after peeking into its
source code, I found all undo related classes were internal. Is there a way to manipulate Infragistics'
undo stack?
Hong
hongyu said: But when a user press Ctrl-Z to undo, how can I tell it's my turn to undo vs UltraGrid's turn?
But when a user press Ctrl-Z to undo, how can I tell it's my turn to undo vs UltraGrid's
turn?
I don't see any way to do this. The grid's undo only accounts for actions that are in included in the AllowMultiCellOperation property. Deleting a row from the grid, and thus from the data source, is not something that grid can undo.
You'd probably have to implement your own undo stack for this and handle all of the undo operations yourself.
That's a very good question . . . I would like to know the answer to that myself.