DataViewBase.RowCellMenuCustomizations Property
Allows you to customize the row cell‘s context menu. You can add new menu items or remove existing items.
Namespace: DevExpress.Xpf.Grid
Assembly: DevExpress.Xpf.Grid.v19.2.Core.dll
Declaration
Property Value
Type | Description |
---|---|
BarManagerActionCollection | A collection of bar actions to customize the row cell‘s context menu. |
Remarks
Example
The following example shows how to create a context menu that allows users to copy a cell’s data and remove rows:
Note
A complete sample project is available at https://github.com/DevExpress-Examples/how-to-access-and-remove-rows-by-using-a-custom-cells-context-menu-e1558.
<dxg:TableView x:Name="view" AutoWidth="True">
<dxg:TableView.RowCellMenuCustomizations>
<dxb:BarButtonItem Name="deleteRowItem" Content="Delete" ItemClick="deleteRowItem_ItemClick" />
<dxb:BarButtonItem Name="copyCellDataItem" Content="Copy Cell Data" ItemClick="copyCellDataItem_ItemClick" />
</dxg:TableView.RowCellMenuCustomizations>
</dxg:TableView>
Private Sub copyCellDataItem_ItemClick(ByVal sender As Object, ByVal e As ItemClickEventArgs)
Dim menuInfo As GridCellMenuInfo = TryCast(view.GridMenu.MenuInfo, GridCellMenuInfo)
If menuInfo IsNot Nothing AndAlso menuInfo.Row IsNot Nothing Then
Dim text As String = "" & grid.GetCellValue(menuInfo.Row.RowHandle.Value, TryCast(menuInfo.Column, GridColumn)).ToString()
Clipboard.SetText(text)
End If
End Sub
Private Sub deleteRowItem_ItemClick(ByVal sender As Object, ByVal e As ItemClickEventArgs)
Dim menuInfo As GridCellMenuInfo = TryCast(view.GridMenu.MenuInfo, GridCellMenuInfo)
If menuInfo IsNot Nothing AndAlso menuInfo.Row IsNot Nothing Then
view.DeleteRow(menuInfo.Row.RowHandle.Value)
End If
End Sub
Note
This property is not available in DXTreeList with the Hierarchical Data Templates.
Refer to the Context Menus topic for more information.
Related GitHub Examples
The following code snippets (auto-collected from DevExpress Examples) contain references to the RowCellMenuCustomizations property.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.