Skip to main content
A newer version of this page is available. .

DataGridView.DragRowOver Event

Occurs each time a row is over another row when being dragged.

Namespace: DevExpress.Maui.DataGrid

Assembly: DevExpress.Maui.DataGrid.dll

NuGet Package: DevExpress.Maui.DataGrid

Declaration

public event EventHandler<DropRowEventArgs> DragRowOver

Event Data

The DragRowOver event's data class is DropRowEventArgs. The following properties provide information specific to this event:

Property Description
Cancel Gets or sets a value indicating whether the event should be canceled. Inherited from CancelEventArgs.
DragItem Gets a data source item that corresponds to the dragged row. Inherited from DragRowEventArgs.
DropItem Gets a data source item that corresponds to the drop target row.
DropRowHandle Gets the grid’s dropped row handle.
RowHandle Returns the handle of the processed row. Inherited from CancelRowEventArgs.

Remarks

The DragRowOver event allows you to manage the drag-and-drop action on stage of moving the row over another rows.

You can prevent dropping the row to specific positions. In this case, no place for row drop is allocated.

  1. Subscribe to the DragRowOver event.

    <dxg:DataGridView AllowDragDropRows="True" 
                      DragRowOver="grid_DragRowOver"/>
    
  2. In the event handler, use the RowHandle property to identify the dragged row, and the DropRowHandle property to identify the drop position. Set the e.Cancel property to true to prohibit row drop.

    The following example shows how to prevent users from dropping a row in a lower position:

    using DevExpress.Maui.DataGrid;
    
    // ...
    private void grid_DragRowOver(object sender, DropRowEventArgs e) {
           if (e.DropRowHandle > e.RowHandle) e.Cancel = true;
    }
    

.NET MAUI DataGrid - Drag and Drop DragRowOver

See Also