Class ContextMenu
ContextMenu provides a pop-up menu that can be positioned anywhere within a View. ContextMenu is analogous to MenuBar and, once activated, works like a sub-menu of a MenuBarItem (but can be positioned anywhere).
By default, a ContextMenu with sub-menus is displayed in a cascading manner, where each sub-menu pops out of the ContextMenu frame (either to the right or left, depending on where the ContextMenu is relative to the edge of the screen). By setting UseSubMenusSingleFrame to true, this behavior can be changed such that all sub-menus are drawn within the ContextMenu frame.
ContextMenus can be activated using the Shift-F10 key (by default; use the Key to change to another key).
Callers can cause the ContextMenu to be activated on a right-mouse click (or other interaction) by calling Show().
ContextMenus are located using screen using screen coordinates and appear above all other Views.
public sealed class ContextMenu : IDisposable
- Inheritance
-
ContextMenu
- Implements
- Inherited Members
Constructors
- ContextMenu()
Initializes a context menu with no menu items.
- ContextMenu(int, int, MenuBarItem)
Initializes a context menu with menu items at a specific screen location.
- ContextMenu(View, MenuBarItem)
Initializes a context menu, with a View specifiying the parent/hose of the menu.
Properties
- ForceMinimumPosToZero
Sets or gets whether the context menu be forced to the right, ensuring it is not clipped, if the x position is less than zero. The default is true which means the context menu will be forced to the right. If set to false, the context menu will be clipped on the left if x is less than zero.
- IsShow
Gets whether the ContextMenu is showing or not.
- MenuItems
Gets or sets the menu items for this context menu.
- MouseFlags
MouseFlags specifies the mouse action used to activate the context menu by mouse.
- Position
Gets or sets the menu position.
- UseSubMenusSingleFrame
Gets or sets if sub-menus will be displayed using a "single frame" menu style. If true, the ContextMenu and any sub-menus that would normally cascade will be displayed within a single frame. If false (the default), sub-menus will cascade using separate frames for each level of the menu hierarchy.
Methods
- Dispose()
Disposes the context menu object.
- Hide()
Hides (closes) the ContextMenu.
Events
- KeyChanged
Event invoked when the Key is changed.
- MouseFlagsChanged
Event invoked when the MouseFlags is changed.