Skip to content

Commit 23f562c

Browse files
ES-975464 - Resolve the ReadMe file length issue in this sample repository
1 parent 19aaecc commit 23f562c

1 file changed

Lines changed: 26 additions & 1 deletion

File tree

README.md

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,27 @@
11
# how_to_discard_all_changes
2-
This sample explains how to undo and redo all the unsaved changes in Spreadsheet
2+
3+
This sample explains how to undo and redo all the unsaved changes in [WPF Spreadsheet](https://www.syncfusion.com/wpf-controls/spreadsheet).
4+
5+
By default, all the unsaved changes are maintained in the `UndoStack` commands collection. To discard all the unsaved changes programmatically, `Execute` the all commands in `UndoStack` collection. By executing the commands in `RedoStack` commands collection, all the discarded changes can be retrieved.
6+
7+
``` c#
8+
//UndoAll the changes
9+
while (this.spreadsheetControl.HistoryManager.UndoStack.Count > 0)
10+
{
11+
var undo = this.spreadsheetControl.HistoryManager.UndoStack.Pop();
12+
if (undo != null)
13+
{
14+
undo.Execute(Syncfusion.UI.Xaml.Spreadsheet.History.CommandMode.Undo);
15+
}
16+
}
17+
18+
//RedoAll the changes
19+
while (this.spreadsheetControl.HistoryManager.RedoStack.Count > 0)
20+
{
21+
var redo = this.spreadsheetControl.HistoryManager.RedoStack.Pop();
22+
if (redo != null)
23+
{
24+
redo.Execute(Syncfusion.UI.Xaml.Spreadsheet.History.CommandMode.Redo);
25+
}
26+
}
27+
```

0 commit comments

Comments
 (0)