LEADTOOLS Annotations for WPF and Silverlight (Leadtools.Windows.Annotations assembly)
LEAD Technologies, Inc

UndoRedoChanged Event

Example 





Occurs when the undo or redo buffer changes. .NET support Silverlight support
Syntax
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
add_UndoRedoChanged(function(sender, e))
remove_UndoRedoChanged(function(sender, e))

public:
event EventHandler^ UndoRedoChanged
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.

Example
Copy CodeCopy 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
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;
}
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;
}
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
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

AnnAutomation Class
AnnAutomation Members

 

 


Products | Support | Contact Us | Copyright Notices

© 2006-2012 All Rights Reserved. LEAD Technologies, Inc.