BaseRow.Index Property

Gets or sets the row's index within a collection of rows located at the same level (sibling rows).

Namespace: DevExpress.XtraVerticalGrid.Rows

Assembly: DevExpress.XtraVerticalGrid.v20.1.dll

Declaration

[Browsable(false)]
public int Index { get; set; }
<Browsable(False)>
Public Property Index As Integer

Property Value

Type Description
Int32

A zero-based index value representing the position of a specific row within a VGridRows collection.

Remarks

This property provides a row's indexed position within the sibling rows collection represented by a VGridRows object. Row indexes are zero-based. You can use this property either to obtain the row index or reposition the row to a different location within the collection it belongs to.

The Index property value can be used to access a specific row via the collection's VGridRows.Item property.

Examples

The following example switches the position of two rows in the grid's VGridControlBase.Rows collection of root level rows. The first row moves down to the last position in the rows collection, while the last one moves up to the first position. The BaseRow.Index property is used for this purpose.

The image below displays the look & feel of a grid control before and after execution of the sample code.

BaseRow_Index

using DevExpress.XtraVerticalGrid.Rows;

private void SwitchUtmostRows() {
    // saving the last row object in a variable
    BaseRow row = vGridControl1.Rows[vGridControl1.Rows.Count - 1];

    // moving the first row to the end of the collection
    vGridControl1.Rows[0].Index = vGridControl1.Rows[vGridControl1.Rows.Count - 1].Index;

    // moving the former last row to the beginning of the collection
    row.Index = 0;
}
See Also