GridMenuEventArgs.Customizations Property
Provides access to a collection of customizations of the grid menu, customized using this event handler.
Namespace: DevExpress.Xpf.Grid
Assembly: DevExpress.Xpf.Grid.v18.2.Core.dll
Declaration
Property Value
Type | Description |
---|---|
BarManagerActionCollection | A BarManagerActionCollection object. |
Remarks
To learn more, see Customizing Context Menus in Context Menus.
Example
The following example demonstrates how to customize the grid’s context menu at runtime. For instance this sample demonstrates how to remove the default ‘Show Column Chooser’ menu item from the Column Context Menu, and add a custom item instead.
For this, it is necessary to handle the DataViewBase.ShowGridMenu event. In the event handler, all modifications to the list of menu items can be done by changing the GridMenuEventArgs.Customizations
collection. To remove a specific menu item along with its link, use the RemoveBarItemAndLinkAction instance, and to add a custom menu item, a new BarButtonItem object must be added to the e.Customizations collection.
Note
A complete sample project is available at https://github.com/DevExpress-Examples/how-to-modify-the-context-menu-of-grid-columns-e1837.
<dxg:GridControl.View>
<dxg:TableView ShowGridMenu="TableView_ShowGridMenu" />
</dxg:GridControl.View>