Leadtools.Windows.Annotations Namespace > AnnAutomation Class : UndoRedoChanged Event |
public event EventHandler UndoRedoChanged
'Declaration Public Event UndoRedoChanged As EventHandler
'Usage Dim instance As AnnAutomation Dim handler As EventHandler AddHandler instance.UndoRedoChanged, handler
public: event EventHandler^ UndoRedoChanged
This event will be fired when the undo/redo buffer changes. This gives the application a chance to update the user interface if needed.
The undo/redo buffer changes whenever an object inside the Container changes either by user interaction through the user interface or by code.
You can use the CanUndo and CanRedo property to determine whether this AnnAutomation can undo or redo an operation.
For more information, refer to Undoing WPF Automation Operations.
Imports Leadtools.Windows.Controls Imports Leadtools.Windows.Annotations Private Sub AnnAutomation_UndoRedoChanged(ByVal manager As AnnAutomationManager) ' subscribe to the UndoRedoChanged event of all automations For Each automation As AnnAutomation In manager.Automations AddHandler automation.UndoRedoChanged, AddressOf automation_UndoRedoChanged Next automation End Sub Private Sub automation_UndoRedoChanged(ByVal sender As Object, ByVal e As EventArgs) Dim automation As AnnAutomation = DirectCast(sender, AnnAutomation) ' assume _menuItemUndo is the Undo menu, and _menuItemRedo is the Redo menu _menuItemUndo.IsEnabled = automation.CanUndo _menuItemRedo.IsEnabled = automation.CanRedo End Sub
using Leadtools.Windows.Controls; using Leadtools.Windows.Annotations; using Leadtools.Demos; using Leadtools.Help; private void AnnAutomation_UndoRedoChanged(AnnAutomationManager manager) { // subscribe to the UndoRedoChanged event of all automations foreach(AnnAutomation automation in manager.Automations) automation.UndoRedoChanged += new EventHandler(automation_UndoRedoChanged); } private void automation_UndoRedoChanged(object sender, EventArgs e) { AnnAutomation automation = sender as AnnAutomation; // assume _menuItemUndo is the Undo menu, and _menuItemRedo is the Redo menu _menuItemUndo.IsEnabled = automation.CanUndo; _menuItemRedo.IsEnabled = automation.CanRedo; }
using Leadtools.Windows.Controls; using Leadtools.Windows.Annotations; using Leadtools.Examples; using Leadtools.Silverlight.Demos; private void AnnAutomation_UndoRedoChanged(AnnAutomationManager manager) { // subscribe to the UndoRedoChanged event of all automations foreach(AnnAutomation automation in manager.Automations) automation.UndoRedoChanged += new EventHandler(automation_UndoRedoChanged); } private void automation_UndoRedoChanged(object sender, EventArgs e) { AnnAutomation automation = sender as AnnAutomation; // assume _menuItemUndo is the Undo menu, and _menuItemRedo is the Redo menu _menuItemUndo.IsEnabled = automation.CanUndo; _menuItemRedo.IsEnabled = automation.CanRedo; }
Imports Leadtools.Windows.Controls Imports Leadtools.Windows.Annotations Imports Leadtools.Silverlight.Demos Private Sub AnnAutomation_UndoRedoChanged(ByVal manager As AnnAutomationManager) ' subscribe to the UndoRedoChanged event of all automations For Each automation As AnnAutomation In manager.Automations AddHandler automation.UndoRedoChanged, AddressOf automation_UndoRedoChanged Next automation End Sub Private Sub automation_UndoRedoChanged(ByVal sender As Object, ByVal e As EventArgs) Dim automation As AnnAutomation = TryCast(sender, AnnAutomation) ' assume _menuItemUndo is the Undo menu, and _menuItemRedo is the Redo menu _menuItemUndo.IsEnabled = automation.CanUndo _menuItemRedo.IsEnabled = automation.CanRedo End Sub