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.v20.2.Core.dll

Declaration

[Browsable(false)]
public BarManagerActionCollection RowCellMenuCustomizations { get; }
<Browsable(False)>
Public ReadOnly Property RowCellMenuCustomizations As BarManagerActionCollection

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:

View Example

<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

Refer to the Context Menus topic for more information.

See Also