Context Menus
- 2 minutes to read
Pivot Grid can display three types of popup menus that enable an end-user to manage data (apply sorting, reorder field headers, etc.) and customize the control by expanding and collapsing field values. All these menus can be customized. For example, you can remove existing menu items and/or add new items.
Context Menus Overview
To obtain the context menu currently being displayed within the PivotGridControl, use the PivotGridControl.GridMenu property.
Menu Type | Description | Availability | Image |
---|---|---|---|
Field Value | This menu is shown when an end-user right-clicks field values. | PivotGridControl.IsFieldValueMenuEnabled | |
Field Header | This menu is shown when an end-user right-clicks a field header. | PivotGridControl.IsHeaderMenuEnabled | |
Header Area | This menu is shown when an end-user right-clicks the Header Area. | PivotGridControl.IsHeaderAreaMenuEnabled |
Customizing Context Menus
PivotGridControl provides multiple properties that allow you to customize its context menus by adding new menu items or removing existing items. These properties return a BarManagerActionCollection object that provides multiple methods, used to manage menu items contained within a context menu.
Menu Type | Property |
---|---|
Field Value | PivotGridControl.FieldValueMenuCustomizations |
Field Header | PivotGridControl.HeaderMenuCustomizations |
Header Area | PivotGridControl.HeaderAreaMenuCustomizations |
Cells | PivotGridControl.CellMenuCustomizations |
When customizing a menu (e.g. removing or moving default items), menu items are referred to by name. Default menu item names are listed in the DefaultMenuItemNames.
You can also handle the PivotGridControl.PopupMenuShowing event raised before a context menu is invoked allowing you to modify it on the fly.