Back to Devexpress

PivotGridControl.MenuItemClick Event

windowsforms-devexpress-dot-xtrapivotgrid-dot-pivotgridcontrol-422ed85b.md

latest5.7 KB
Original Source

PivotGridControl.MenuItemClick Event

Allows custom responses to be provided for clicks on context menu items.

Namespace : DevExpress.XtraPivotGrid

Assembly : DevExpress.XtraPivotGrid.v25.2.dll

NuGet Package : DevExpress.Win.PivotGrid

Declaration

csharp
public event PivotGridMenuItemClickEventHandler MenuItemClick
vb
Public Event MenuItemClick As PivotGridMenuItemClickEventHandler

Event Data

The MenuItemClick event's data class is PivotGridMenuItemClickEventArgs. The following properties provide information specific to this event:

PropertyDescription
AllowGets or sets whether to display the context menu. Inherited from BasePopupMenuShowingEventArgs.
AreaGets the area of the field whose header or value has been right-clicked by a user to invoke the context menu. Inherited from PivotGridMenuEventArgsBase.
FieldGets the field whose header has been right-clicked by an end-user.
HitInfoGets details on the grid elements located at the point where an end-user has right-clicked to invoke the context menu.
ItemGets the menu item that has been clicked. Inherited from PivotGridMenuItemClickEventArgsBase.
MenuGets or sets the Pivot Grid’s context menu. Inherited from PivotGridMenuEventArgsBase.
MenuTypeGets the type of the invoked menu. Inherited from PivotGridMenuEventArgsBase.
PointGets or sets coordinates of the invoked context menu (top-left corner) relative to the parent control. Inherited from BasePopupMenuShowingEventArgs.
ScreenPointGets coordinates of the invoked context menu (top-left corner) relative to the screen. Inherited from BasePopupMenuShowingEventArgs.

The event data class exposes the following methods:

MethodDescription
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 MenuItemClick event fires when selecting a specific item within a Pivot Grid Control’s menus. It enables you to cancel the default actions performed when a particular item is clicked, and instead, implement your own handling. The clicked item is represented by the event’s PivotGridMenuItemClickEventArgsBase.Item parameter.

You can identify the clicked item using the Item.Tag property. Tags of standard menu items are listed by static fields of the PivotContextMenuIds abstract class. Use values of these fields to identify a particular menu item. For the ‘Sort … by This Column/Row’ items displayed in column/row header context menus and used to apply Sorting by Summary, the DXMenuItem.Tag property stores a PivotGridFieldPair object that refers to the current data and column/row fields.

The MenuItemClick event is not raised when menu items created manually are clicked. Custom items can be added to menus via the PivotGridControl.PopupMenuShowing event handler.

See Also

PopupMenuShowing

PivotGridControl Class

PivotGridControl Members

DevExpress.XtraPivotGrid Namespace