Row and cell location

The grid has two row indexing systems. GridControl.Rows performs hierarchy-independent linear indexing of visible rows in a grid. It means that this collection contains all visible (not filtered and non-collapsed by parent) rows. Row.VisibleIndex property specifies position of a visible row in GridControl.Rows. The second time of indexing is related to hierarchical structure of the grid. Rows at the first hierarchy level can be accessed with GridControl.Nodes property. This collection contains both visible and invisible rows that are located on the same hierarchy level. Every row may contain child rows that can be accessed via Row.Children property. Neither filtering, nor visibility affect row presence in this collection. Row.ChildIndex property defines hierarchical position of a row. If the row is on the top level, it is in GridControl.Nodes, otherwise it is in parent Row.Children container. The row also has Row.VisibleChildren container that contains only visible children on the same hierarchy level. You can use Row.VisibleChildIndex property to determine Row position in Row.VisibleChildren of the parent.

Wpf Grid: row location

One row can be present in different containers, including GridControl.RowsGridControl.NodesRow.Children, etc. Containers organize grid structure and enable precise definition of data location. For hierarchies the grid provides a convenient API that can be used to determine parent, children and adjacent visible rows. The list of most frequent methods and properties used for data indexing is provided below.

Property or methodDescription
GridControl.RowsCollection of all visible rows in the grid.
GridControl.NodesCollection of both visible and invisible rows on the top hierarchy level.
Row.ChildrenCollection of both visible and invisible children.
Row.VisibleChildrenCollection of visible children on the same hierarchy level.
Row.ParentParent row or null if the current row is on the top hierarchy level.
Row.VisibleIndexRow position in GridControl.Rows
Row.ChildIndexRow position in GridControl.Nodes or parent Row.Children
Row.VisibleChildIndexRow position in parent Row.VisibleChildren
Row.NextVisibleNext visible row in parent Row.VisibleChildren container.
Row.PrevVisiblePrevious visible row in parent Row.VisibleChildren container.
Row.FirstVisibleChildFirst visible child.
Row.LastVisibleChildLast visible child.
GridControl.Rows.TopVisibleRowThe first row in visible area of the grid.
GridControl.Rows.BottomVisibleRowThe last row that is at least partially visible in the visible area of the grid.
GridControl.Rows.BottomFullyVisibleRowThe last fully visible row in the visible area of the grid.

If you work with reference-type data objects, you can use convenient grid features to search for row or rows containing the required data object.

You can get a data object that is associated with a row by calling Row.DataObject property. The same data object may be contained in multiple grid rows. You can get them using GridControl.DataObjects.Find(Object) method. If you need only the first row, you can use GridControl.DataObjects.FindFirstRow(Object) method.

Back to Wpf GridControl features