DataViewBase.ShowGridMenu Event

Enables you to customize the context menu.

Namespace: DevExpress.Xpf.Grid

Assembly: DevExpress.Xpf.Grid.v20.1.Core.dll

Declaration

public event GridMenuEventHandler ShowGridMenu
Public Event ShowGridMenu As GridMenuEventHandler

Event Data

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

Property Description
Customizations Provides access to a collection of customizations of the grid menu, customized using this event handler.
Handled Gets or sets a value that indicates the present state of the event handling for a routed event as it travels the route. Inherited from RoutedEventArgs.
Items Gets the menu items contained within the context menu.
MenuInfo Gets information about the context menu.
MenuType Gets the context menu's type.
OriginalSource Gets the original reporting source as determined by pure hit testing, before any possible Source adjustment by a parent class. Inherited from RoutedEventArgs.
RoutedEvent Gets or sets the RoutedEvent associated with this RoutedEventArgs instance. Inherited from RoutedEventArgs.
Source Gets the View that raised the event.
TargetElement Gets the UI element for which the context menu is shown.

Remarks

The GridControl's pop-up menus allow users to manage data (apply grouping and sorting, display summaries, and so on) and customize the View (show and hide its UI elements). All these context menus can be customized.

For information on how you can customize context menus, see Context Menus.

Example

The following example removes an item from the Total Summary panel's context menu:

Handle the ShowGridMenu event.

<dxg:TableView ShowGridMenu="ShowGridMenu" />
void ShowGridMenu(object sender, GridMenuEventArgs e) {
    if (e.MenuType == GridMenuType.TotalSummary) {
        e.Customizations.Add(new RemoveAction { ElementName = DefaultSummaryMenuItemNames.Customize });
    }
}
See Also