LEADTOOLS Annotations for WPF and Silverlight (Leadtools.Windows.Annotations assembly) Send comments on this topic. | Back to Introduction - All Topics | Help Version 17.0.3.31
UndoRedoChanged Event
See Also 
Leadtools.Windows.Annotations Namespace > AnnAutomation Class : UndoRedoChanged Event



The UndoRedoChanged Event supports WPF/Silverlight.

The UndoRedoChanged Event is available in LEADTOOLS Document and Medical Imaging toolkits.

Occurs when the undo or redo buffer changes. Supported in Silverlight, Windows Phone 7

Syntax

Visual Basic (Declaration) 
Public Event UndoRedoChanged As EventHandler
Visual Basic (Usage)Copy Code
Dim instance As AnnAutomation
Dim handler As EventHandler
 
AddHandler instance.UndoRedoChanged, handler
C# 
public event EventHandler UndoRedoChanged
C++/CLI 
public:
event EventHandler^ UndoRedoChanged

Example

This example updates an Undo and Redo menu handler's status.

Visual BasicCopy Code
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
C#Copy Code
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;
}
SilverlightCSharpCopy Code
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;
}
SilverlightVBCopy Code
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

Remarks

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.

Requirements

Target Platforms: Silverlight 3.0, Windows XP, Windows Server 2003 family, Windows Server 2008 family, Windows Vista, Windows 7, MAC OS/X (Intel Only)

See Also

Reference

AnnAutomation Class
AnnAutomation Members

UndoRedoChanged requires a Document/Medical product license and unlock key. For more information, refer to: Imaging Pro/Document/Medical Features and Unlocking Special LEAD Features.