Skip to main content

PivotGridControl.PopupMenuShowing Event

Allows you to customize context menus.

Namespace: DevExpress.XtraPivotGrid

Assembly: DevExpress.XtraPivotGrid.v23.2.dll

NuGet Package: DevExpress.Win.PivotGrid

Declaration

public event PopupMenuShowingEventHandler PopupMenuShowing

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 allow the action. Inherited from PivotGridMenuEventArgsBase.
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 the location at which the context menu has been invoked. Inherited from PivotGridMenuEventArgsBase.

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.

Examples

View Example: Pivot Grid for WinForms - How to change SummaryDisplayType in the Context Menu

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.

custom-context-menu

View Example: Pivot Grid for WinForms - How to Customize the Popup Menu to Hide or Show the Totals

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.

custom-header-area-popup-menu

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.

See Also