Skip to main content

DragGridEventArgs.Data Property

Gets or sets the dragged data elements.

Namespace: DevExpress.XtraGrid.Views.Grid

Assembly: DevExpress.XtraGrid.v24.1.dll

NuGet Packages: DevExpress.Win.Grid, DevExpress.Win.Navigation


public object Data { get; }

Property Value

Type Description

An object that specifies the dragged data elements.


Use the following properties and methods to obtain the dragged data elements:

  • Data — gets an array of the dragged elements (an array of objects).

    For the grid control, these objects are row handles of the dragged grid rows.

  • GetData<T>() — returns an array of the dragged elements cast to the specified type.

    If these objects cannot be cast to the specified type, the method returns the type default value.

  • DataRows — gets an array of objects that are data rows that correspond to the dragged grid rows.

    The Data property returns handles for the dragged grid rows. The DataRows property returns data rows that correspond to these grid rows. The actual data row type depends on the bound data source. For example, if the control is bound to a DataTable or a DataView object, the data row is a DataRowView object.

  • GetDataRows<T>() — returns an array of data rows cast to the specified data type.

    This method casts elements in the DataRows collections to the specified type and returns the resulting array.

object rowHandles = args.Data;
int[] rowHandleArray = rowHandles as int[];
int[] rowHandles1 = args.GetData<int[]>();
object[] dataRows = args.DataRows;
DataRowView dataRow = dataRows[0] as DataRowView;
DataRowView[] dataRows1 = args.GetDataRows<DataRowView>();
See Also