Articles in this section
Category / Section

How to perform undo or redo functionality in WinForms TreeViewAdv using HistoryManager property?

1 min read

Undo and Redo

The user should get the HistoryManager to use and then the HistoryEnabled property should be set to true. The HistoryManager plays the role in the Undo or Redo actions.

The Undo and Redo functionality of a TreeViewAdv does the following actions:

1. Deleting a node

2. Adding a node

3. Editing node's Text

4. Drag and drop of a node

C#

private void barItem1_Click(object sender, System.EventArgs e)
{
   if(this.treeViewAdv1.HistoryManager.CanUndo==true)
   {
       this.treeViewAdv1.HistoryManager.Undo();
   }
}
private void barItem2_Click(object sender, System.EventArgs e)
{
   if(this.treeViewAdv1.HistoryManager.CanRedo==true)
   {
       this.treeViewAdv1.HistoryManager.Redo();
   }
}

VB

Private Sub barItem1_Click(ByVal sender As Object, ByVal e As System.EventArgs)
   If Me.treeViewAdv1.HistoryManager.CanUndo=True Then
       Me.treeViewAdv1.HistoryManager.Undo()
   End If
End Sub
Private Sub barItem2_Click(ByVal sender As Object, ByVal e As System.EventArgs)
   If Me.treeViewAdv1.HistoryManager.CanRedo=True Then
       Me.treeViewAdv1.HistoryManager.Redo()
   End If
End Sub

Reference link: https://help.syncfusion.com/windowsforms/treeview/history-manager

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments
Please sign in to leave a comment
Access denied
Access denied