Back to Devexpress

GridControl.GetChildRowCount(Int32) Method

wpf-devexpress-dot-xpf-dot-grid-dot-gridcontrol-dot-getchildrowcount-x28-system-dot-int32-x29.md

latest5.0 KB
Original Source

GridControl.GetChildRowCount(Int32) Method

Returns the number of child rows (group or data) contained within the specified group row.

Namespace : DevExpress.Xpf.Grid

Assembly : DevExpress.Xpf.Grid.v25.2.dll

NuGet Package : DevExpress.Wpf.Grid.Core

Declaration

csharp
public int GetChildRowCount(
    int rowHandle
)
vb
Public Function GetChildRowCount(
    rowHandle As Integer
) As Integer

Parameters

NameTypeDescription
rowHandleInt32

An integer value that specifies the group row’s handle.

|

Returns

TypeDescription
Int32

An integer value that specifies the number of child rows contained within the specified group row.

|

Remarks

Note

The GetChildRowCount method is intended only for group rows and should not be called for regular rows. Though the group row handles are negative (starting from -1 ), the GetChildRowCount method treats all passed values as group row handles (i.e., it returns the same value for negative and positive values).

To obtain the handle of the specified child row, use the GridControl.GetChildRowHandle method. A child row is identified by its visible index (position) within the specified group row.

Note

If the GetChildRowCount method is called for a non-expanded group row that contains embedded group rows, it returns 0.

To learn more, see Identifying Rows and Cards.

The following code snippets (auto-collected from DevExpress Examples) contain references to the GetChildRowCount(Int32) method.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

how-to-create-search-window-with-find-previous-and-find-next-buttons-in-gridcontrol-t127527/CS/DevExpress.Example01/SearchBehavior/SearchWindow.xaml.cs#L245

csharp
int i = -1;
while(++i < this._Grid.GetChildRowCount(groupRowHandle)) {
    int rowHandle = this._Grid.GetChildRowHandle(groupRowHandle, i);

wpf-grid-select-child-rows-in-groups-on-click/CS/GridGroupSelect/GroupChildSelector.cs#L41

csharp
static void SelectChild(GridControl grid, int groupRowHandle) {
    int childRowCount = grid.GetChildRowCount(groupRowHandle);
    grid.BeginSelection();

how-to-create-search-window-with-find-previous-and-find-next-buttons-in-gridcontrol-t127527/VB/DevExpress.Example01/SearchBehavior/SearchWindow.xaml.vb#L240

vb
Dim i As Integer = -1
While Threading.Interlocked.Increment(i) < _Grid.GetChildRowCount(groupRowHandle)
    Dim rowHandle As Integer = _Grid.GetChildRowHandle(groupRowHandle, i)

wpf-grid-select-child-rows-in-groups-on-click/VB/GridGroupSelect/GroupChildSelector.vb#L47

vb
Private Shared Sub SelectChild(ByVal grid As GridControl, ByVal groupRowHandle As Integer)
    Dim childRowCount As Integer = grid.GetChildRowCount(groupRowHandle)
    grid.BeginSelection()

See Also

GetChildRowHandle(Int32, Int32)

Grouping

GridControl Class

GridControl Members

DevExpress.Xpf.Grid Namespace