GridControl.ColumnMenu Property
Gets or sets a context menu that is invoked when a user right-clicks a column header.
Namespace: DevExpress.WinUI.Grid
Assembly: DevExpress.WinUI.Grid.v23.2.dll
NuGet Package: DevExpress.WinUI
#Declaration
#Property Value
Type | Description |
---|---|
Object | A UI element invoked when a user right-clicks a column header. |
#Remarks
The ColumnMenu property allows you to define a custom context menu for column headers. To do this, assign a MenuFlyout control to this property.
When you assign a menu control to the ColumnMenu property, this control’s DataContext is set to an object of the GridColumnContextMenuInfo type. This class contains information about the GridControl, the view model stored in its DataContext, the target column, and so on.
The following code sample demonstrates how to specify a column header’s context menu:
<dxg:GridControl ...>
<dxg:GridControl.ColumnMenu>
<MenuFlyout>
<MenuFlyoutItem Text="Clear Grouping"
Command="{Binding Commands.ClearGrouping}"
Visibility="{Binding Column.IsGrouped}"/>
<MenuFlyoutItem Text="Clear Filter"
Command="{Binding Commands.ClearFilter}"/>
</MenuFlyout>
</dxg:GridControl.ColumnMenu>
</dxg:GridControl>