GridViewBase.GridMenu Property
Gets the context menu that is displayed within a View.
Namespace: DevExpress.Xpf.Grid
Assembly: DevExpress.Xpf.Grid.v24.2.dll
NuGet Package: DevExpress.Wpf.Grid.Core
Declaration
Property Value
Type | Description |
---|---|
GridPopupMenu | The context menu displayed within a View. null if no menu is displayed within a View. |
Remarks
Refer to the Context Menus topic for more information.
Example
This example shows how to define a cell’s context menu. The context menu allows users to delete a row or copy its data to the clipboard.
<dxg:GridControl.View>
<dxg:TableView x:Name="view" AutoWidth="True">
<dxg:TableView.RowCellMenuCustomizations>
<dxb:BarButtonItem Name="deleteRowItem" Content="Delete"
IsEnabled="{Binding Row.Row.CanBeDeleted}"
ItemClick="OnDeleteRow"/>
<dxb:BarButtonItem Name="copyCellDataItem" Content="Copy"
ItemClick="OnCopyRow" />
</dxg:TableView.RowCellMenuCustomizations>
</dxg:TableView>
</dxg:GridControl.View>
void OnCopyRow(object sender, ItemClickEventArgs e) {
if (view.GridMenu.MenuInfo is GridCellMenuInfo menuInfo && menuInfo.Row != null)
grid.CopyCurrentItemToClipboard();
}
void OnDeleteRow(object sender, ItemClickEventArgs e) {
if (view.GridMenu.MenuInfo is GridCellMenuInfo menuInfo && menuInfo.Row != null)
view.DeleteRow(menuInfo.Row.RowHandle.Value);
}
See Also