Skip to main content

CustomColumnDisplayTextEventArgs.ListSourceRowIndex Property

Gets the index in the data source of the row which contains the cell currently being processed.

Namespace: DevExpress.XtraGrid.Views.Base

Assembly: DevExpress.XtraGrid.v22.2.dll

NuGet Package: DevExpress.Win.Grid


public int ListSourceRowIndex { get; }

Property Value

Type Description

An integer value representing the row’s index in the data source. Row handles are not data source indexes, see the Accessing Rows in Code. Row Handles section of the “Rows” article for more information.


Use the ListSourceRowIndex property to identify the record in the data source that contains the currently processed cell. If this row index refers to a valid row (see below), you can use the ColumnView.GetListSourceRowCellValue method to obtain the row’s other cell values.

This property returns the same value for both Auto Filter and New Item rows. If you need to show custom strings in these rows’ cells, use the GridView.CustomDrawCell event instead.

private void Gv_CustomDrawCell(object sender, XtraGrid.Views.Base.RowCellCustomDrawEventArgs e)
    if (e.RowHandle == GridControl.AutoFilterRowHandle)
        e.DisplayText = "AutoFilterRow";
    if (e.RowHandle == GridControl.NewItemRowHandle)
        e.DisplayText = "NewItemRow";

When the ColumnView.CustomColumnDisplayText event is called to provide cell display text for a group row, the ListSourceRowIndex property will match the data source index of the first data row that follows the group row.

When the ColumnView.CustomColumnDisplayText event is called to customize filter values in a column’s Filter DropDown, the ListSourceRowIndex property returns the GridControl.InvalidRowHandle constant. In this case, it is not possible to determine the currently processed row, and therefore obtain other cell values.

See Also