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
ContextMenu Property
See Also 
Leadtools.Windows.Annotations Namespace > AnnAutomationManager Class : ContextMenu Property



The ContextMenu Property supports WPF/Silverlight.

The ContextMenu Property is available in LEADTOOLS Document and Medical Imaging toolkits.

Gets or sets the main automation context menu.

Syntax

Visual Basic (Declaration) 
Public Property ContextMenu As ContextMenu
Visual Basic (Usage)Copy Code
Dim instance As AnnAutomationManager
Dim value As ContextMenu
 
instance.ContextMenu = value
 
value = instance.ContextMenu
C# 
public ContextMenu ContextMenu {get; set;}
C++/CLI 
public:
property ContextMenu^ ContextMenu {
   ContextMenu^ get();
   void set (    ContextMenu^ value);
}

Property Value

The main automation context menu

Example

This example adds a "Test" menu item to the main automation context menu.

Visual BasicCopy Code
Private Sub AnnAutomationManager_ContextMenu(ByVal manager As AnnAutomationManager)
   Dim cm As ContextMenu = manager.ContextMenu
   ' add a separator
   cm.Items.Add(New Separator())
   ' add a test menu item
   Dim mi As MenuItem = New MenuItem()
   mi.Header = "Test"
   AddHandler mi.Click, AddressOf MyTestMenuItemHandler
   cm.Items.Add(mi)
End Sub
Private Sub MyTestMenuItemHandler(ByVal sender As Object, ByVal e As RoutedEventArgs)
   MessageBox.Show("Test clicked")
End Sub
C#Copy Code
private void AnnAutomationManager_ContextMenu(AnnAutomationManager manager)
{
   ContextMenu cm = manager.ContextMenu;
   // add a separator
   cm.Items.Add(new Separator());
   // add a test menu item
   MenuItem mi = new MenuItem();
   mi.Header = "Test";
   mi.Click += new RoutedEventHandler(MyTestMenuItemHandler);
   cm.Items.Add(mi);
}
private void MyTestMenuItemHandler(object sender, RoutedEventArgs e)
{
   MessageBox.Show("Test clicked");
}
SilverlightCSharpCopy Code
SilverlightVBCopy Code

Remarks

This is the menu that appears when the user clicks anywhere on a container but not on any of the objects currently in the container. You can directly manipulate this context menu or set your own System.Windows.Controls.ContextMenu derived class if desired.

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

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