GridControl.RowCellMenu Property
Gets or sets the context menu that is invoked when the end-user right-clicks a data cell, a row or within the Row Indicator Panel.
Namespace: DevExpress.UI.Xaml.Grid
Assembly: DevExpress.UI.Xaml.Grid.v21.2.dll
NuGet Package: DevExpress.Uwp.Controls
Declaration
Property Value
Type | Description |
---|---|
Object | The UI element invoked when the end-user right-clicks a data cell, a row or within the row indicator panel. |
Remarks
The RowCellMenu property allows you to define a custom Context Menu for GridControl rows and cells. You can use either the standard MenuFlyout control in this property, or our ContextToolbarControl or ToolbarControl.
When you define a menu control in RowCellMenu, this control’s DataContext is set to an object of the GridRowCellContextMenuInfo class. This class provides information about your GridControl, a target row, cell, column, etc. You can use this information to process different actions at your view model level.
The below snippet illustrates how to define ContextToolbarControl in this property:
xmlns:dxg="using:DevExpress.UI.Xaml.Grid"
xmlns:dxr="using:DevExpress.UI.Xaml.Ribbon"
<dxg:GridControl ...>
<dxg:GridControl.RowCellMenu>
<dxr:ContextToolbarControl Orientation="Vertical">
<dxr:ContextToolbarGroup>
<dxr:ContextToolbarButton Content="Duplicate"
Command="{Binding Grid.DataContext.DuplicateCommand}"
CommandParameter="{Binding Row.Row}"/>
<dxr:ContextToolbarButton Content="Delete"
Command="{Binding Grid.DataContext.DeleteCommand}"
CommandParameter="{Binding Row.Row}"/>
</dxr:ContextToolbarGroup>
</dxr:ContextToolbarControl>
</dxg:GridControl.RowCellMenu>
</dxg:GridControl>
Note
A complete sample project is available at https://github.com/DevExpress-Examples/how-to-implement-the-context-menu-for-gridcontrol-rows-and-cells