Skip to main content

DragGridEventArgs.GetDataRows<T>() Method

Returns the array of data rows that correspond to the dragged grid rows. Casts the returned elements to the specified data type.

Namespace: DevExpress.XtraGrid.Views.Grid

Assembly: DevExpress.XtraGrid.v23.2.dll

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

Declaration

public T[] GetDataRows<T>()

Type Parameters

Name Description
T

The data type.

Returns

Type Description
T[]

An array of data elements of the specified type.

Remarks

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