Back to Devexpress

Context Menus

wpf-8314-controls-and-libraries-pivot-grid-end-user-interaction-context-menus.md

latest3.2 KB
Original Source

Context Menus

  • Apr 01, 2021
  • 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 TypeDescriptionAvailabilityImage
Field ValueThis menu is shown when an end-user right-clicks field values.PivotGridControl.IsFieldValueMenuEnabled
Field HeaderThis menu is shown when an end-user right-clicks a field header.PivotGridControl.IsHeaderMenuEnabled
Header AreaThis 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 TypeProperty
Field ValuePivotGridControl.FieldValueMenuCustomizations
Field HeaderPivotGridControl.HeaderMenuCustomizations
Header AreaPivotGridControl.HeaderAreaMenuCustomizations
CellsPivotGridControl.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.

See Also

Context Menu Examples