Back to Devexpress

GridControl.GetParentRowHandle(Int32) Method

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

latest3.6 KB
Original Source

GridControl.GetParentRowHandle(Int32) Method

Returns the handle of the group row that owns the specified row.

Namespace : DevExpress.Xpf.Grid

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

NuGet Package : DevExpress.Wpf.Grid.Core

Declaration

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

Parameters

NameTypeDescription
rowHandleInt32

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

|

Returns

TypeDescription
Int32

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

|

Remarks

Group row handles are negative (starting from -1 ). The GetParentRowHandle method returns DataControlBase.InvalidRowHandle in the cases listed below:

  • the specified handle corresponds to a root group row
  • the grid’s data isn’t grouped
  • there is no row within the specified handle.

To learn more, see Obtaining Row Handles.

Note

In server mode, the GetParentRowHandle returns the DataControlBase.InvalidRowHandle value if data is grouped by two or more columns.

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the GetParentRowHandle(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.

wpf-grid-prevent-expand-collapse-operations-for-group-rows/CS/Forbid_Expand_Collapse/MainWindow.xaml.cs#L15

csharp
var childRow = grid.FindRowByValue(grid.Columns[nameof(Invoice.Status)], InvoiceStatus.Invalidated);
var groupRow = grid.GetParentRowHandle(childRow);
grid.ExpandGroupRow(groupRow);

wpf-grid-prevent-expand-collapse-operations-for-group-rows/VB/Forbid_Expand_Collapse/MainWindow.xaml.vb#L18

vb
Dim childRow = Me.grid.FindRowByValue(Me.grid.Columns(NameOf(Invoice.Status)), InvoiceStatus.Invalidated)
Dim groupRow = Me.grid.GetParentRowHandle(childRow)
Me.grid.ExpandGroupRow(groupRow)

See Also

GridControl Class

GridControl Members

DevExpress.Xpf.Grid Namespace