A context menu is shown by default when right-clicking on the PageView control. When right-clicking on the image, a context menu is displayed with image settings such as zoom settings, antialiasing, and resampling. The PageView context menu can be disabled by setting the ContextMenu property to null. You could also override the ContextMenuOpening event to handle this event however you want.
If you reference the ImageGear.Windows.Controls.Art.dll in your project, then a context menu that corresponds to the specific type of annotation mark will be displayed when clicking on an annotation mark. This context menu contains menu items such as the width and style of a line, for example, if you right-click on a line annotation mark. This context menu also contains the common mark menu items that are available in the Annotator context menu (such as Delete, Copy, and Properties) as well as a Page sub-menu with the default image context menu items. If ImageGear.Windows.Controls.Art.dll is not referenced or located by your application, then the image context menu will be displayed when clicking on an annotation mark.
ImageGear.Windows.Controls.Art.dll replaces the ImageGear.Art.Windows.Controls namespace/assembly (which includes the Annotator/ToolBarAnnotator controls), so that the annotation user interface can now be accessed through PageView instead of a separate Annotator/ToolBarAnnotator control. If you are still using Annotator or ToolBarAnnotator, the behavior will be the same as in previous versions of ImageGear (i.e., the PageView context menu will not be displayed; the context menu that Annotator displays will still be displayed when right-clicking on an annotation).
Customizing the Context Menu
XAML for the default context menu is provided in the WPF_ART sample in the file "MainWindow.xaml". This XAML can be copied to your project’s XAML and modified to customize the PageView context menu. Numerous commands are available in PageView so the action that occurs when selecting a context menu item can be easily specified. The PageView context menu supports objects of type MenuItem and Separator.
The context menu functionality is included in the ImGearPageViewContextMenu class, which derives from the ContextMenu class. The PageView.ContextMenu property can be set to an instance of the ImGearPageViewContextMenu class (which is done internally by default to create the default context menu) but also still supports simply being set to a new instance of the ContextMenu class.
The ImGearPageViewContextMenu class can be used to specify which context menu items appear when right-clicking on the PageView image or when right clicking on a specific type of annotation mark. The ImGearPageViewContextMenu.PageItems property contains the collection of menu items that are displayed when right-clicking on the PageView image. ImGearPageViewContextMenu.AnnotationItems contains a collection property for each annotation mark type (ImGearPageViewContextMenu.AnnotationItems.Curve, ImGearPageViewContextMenu.AnnotationItems.Ellipse, etc.), which can be used to specify the menu items that are displayed when right-clicking on an annotation mark of that type.
ImGearPageViewContextMenu.AnnotationItems also contains a Common property, which can be used to specify context menu items that are shown when clicking on any annotation mark type. These are shown under the specific annotation mark context menu items. If menu items are added to ImGearPageViewContextMenu.Items, these are displayed at the bottom of the context menu.
The ImGearPageViewContextMenu.Custom property can be used to specify the context menu items that are displayed when right clicking on a custom mark, as demonstrated in the WPF ART sample. This property can be set to a dictionary of object collections, where each object is either a MenuItem or a Separator. The name of a custom mark class that you have registered should be used for the key of an object collection in the dictionary.
To display a mark properties window for your custom mark (when the Properties context menu item is selected, or when the PageView.ShowMarkPropertiesWindow method is called for a custom mark), you can override the GetPropertiesWindow method of your custom mark class that derives from ImGearAnnotatorMarkController, ImGearAnnotatorRectangleController or ImGearAnnotatorPolyController. This method will need to return an instance of a class that implements IImGearMarkEditorWindow.