GridControl.GridMenu Property
Gets or sets a context menu that is invoked when a user right-clicks an empty space within the GridControl.
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 an empty space within the Grid |
#Remarks
The GridMenu property allows you to define a custom context menu for the GridControl‘s empty space. To do this, assign a MenuFlyout control to this property.
When you assign a menu control to the GridMenu, this control’s DataContext is set to an object of the GridCommonContextMenuInfo type. This class contains information about the GridControl, the view model stored in its DataContext, and so on. You can use this information to process user actions at the view model level.
The following code sample demonstrates how to specify a context menu for the GridControl‘s empty space:
<dxg:GridControl x:Name="grid" ...>
<dxg:GridControl.GridMenu>
<MenuFlyout>
<MenuFlyoutItem Text="Add a New Row"
Click="MenuFlyoutItem_Click"/>
<MenuFlyoutItem Text="Show Column Chooser"
Command="{x:Bind grid.Commands.ShowColumnChooser}"/>
</MenuFlyout>
</dxg:GridControl.GridMenu>
</dxg:GridControl>