PivotGridControl.PopupMenuShowing Event
Allows you to customize built-in context menus or invoke custom menus.
Namespace: DevExpress.XtraPivotGrid
Assembly: DevExpress.XtraPivotGrid.v24.2.dll
Declaration
Event Data
The PopupMenuShowing event's data class is PopupMenuShowingEventArgs. The following properties provide information specific to this event:
Property | Description |
---|---|
Allow | Gets or sets whether to display the context menu. Inherited from BasePopupMenuShowingEventArgs. |
Area | Gets the area of the field whose header or value has been right-clicked by a user to invoke the context menu. Inherited from PivotGridMenuEventArgsBase. |
Field | Gets the field whose header or value has been right-clicked by an end-user. |
HitInfo | Gets info about the point where the context menu should be invoked. |
Menu | Gets or sets the Pivot Grid’s context menu. Inherited from PivotGridMenuEventArgsBase. |
MenuType | Gets the type of the invoked menu. Inherited from PivotGridMenuEventArgsBase. |
Point | Gets or sets coordinates of the invoked context menu (top-left corner) relative to the parent control. Inherited from BasePopupMenuShowingEventArgs. |
ScreenPoint | Gets coordinates of the invoked context menu (top-left corner) relative to the screen. Inherited from BasePopupMenuShowingEventArgs. |
The event data class exposes the following methods:
Method | Description |
---|---|
ShowCustomMenu(IDXDropDownControlEx) | Invokes a custom context menu instead of the control’s menu. Inherited from BasePopupMenuShowingEventArgs. |
ShowCustomMenu(ContextMenuStrip) | Invokes a custom context menu instead of the control’s menu. Inherited from BasePopupMenuShowingEventArgs. |
Remarks
The PivotGrid control contains multiple context menus in the UI. You can use the PivotGridControl.OptionsMenu property to control the availability of these menus.
The PopupMenuShowing event fires each time a user invokes the PivotGrid’s context menu. This event allows you to identify which menu is opened, customize the menu, or prevent it from being invoked.
Use the event parameter’s e.Point and e.HitInfo properties to identify the right-clicked point and obtain the UI element under the point.
For the field header and value context menus, use the e.Field and e.Area properties. These properties identify the right-clicked field and the field’s location.
Use the e.Menu property to obtain the invoked context menu and customize it. The e.MenuType property identifies the menu type.
To specify whether a user can invoke the context menu, use the e.Allow property.
The e.ShowCustomMenu method allows you to invoke a custom context menu.
Examples
This example shows how to customize the field header’s context menu in the PopupMenuShowing event handler. The event adds a new item to the Number field header’s context menu and allows you to change the SummaryDisplayType value.
This example demonstrates how to add a new item to the field header’s context menu. This item shows or hides totals in the PivotGrid control.
Related GitHub Examples
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the PopupMenuShowing event.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.