Back to Devexpress

GridControl.IsGroupRowHandle(Int32) Method

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

latest7.6 KB
Original Source

GridControl.IsGroupRowHandle(Int32) Method

Indicates whether the specified handle corresponds to a group row.

Namespace : DevExpress.Xpf.Grid

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

NuGet Package : DevExpress.Wpf.Grid.Core

Declaration

csharp
public bool IsGroupRowHandle(
    int rowHandle
)
vb
Public Function IsGroupRowHandle(
    rowHandle As Integer
) As Boolean

Parameters

NameTypeDescription
rowHandleInt32

An integer value that specifies the row’s handle.

|

Returns

TypeDescription
Boolean

true if the specified handle corresponds to a group row; otherwise, false.

|

Remarks

Group row handles are negative (start from -1 ). The IsGroupRowHandle method returns false , if the specified handle corresponds to a data row or invalid row.

To learn more, see Grouping and Identifying Rows and Cards.

Example

The following example demonstrates how to use the TableView.RowDoubleClick event to process double-clicks:

View Example: How to Handle Row Double-clicks

xaml
<dxg:GridControl x:Name="grid">
<!-- ... -->
    <dxg:GridControl.View>
        <dxg:TableView RowDoubleClick="OnRowDoubleClick"/>
    </dxg:GridControl.View>
</dxg:GridControl>
csharp
void OnRowDoubleClick(object sender, RowDoubleClickEventArgs e) {
    int rowHandle = e.HitInfo.RowHandle;
    if(rowHandle == GridControl.InvalidRowHandle)
        return;
    if(grid.IsGroupRowHandle(rowHandle))
        MessageBox.Show("A group row has been double clicked.", "Info");
    else
        MessageBox.Show("A data row has been double clicked.", "Info");
}
vb
Private Sub OnRowDoubleClick(ByVal sender As Object, ByVal e As RowDoubleClickEventArgs)
    Dim rowHandle As Integer = e.HitInfo.RowHandle
    If rowHandle = DataControlBase.InvalidRowHandle Then Return
    If Me.grid.IsGroupRowHandle(rowHandle) Then
        MessageBox.Show("A group row has been double clicked.", "Info")
    Else
        MessageBox.Show("A data row has been double clicked.", "Info")
    End If
End Sub

The following code snippets (auto-collected from DevExpress Examples) contain references to the IsGroupRowHandle(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#L231

csharp
int rowHandle = this._Grid.GetRowHandleByVisibleIndex(i);
if(this._Grid.IsGroupRowHandle(rowHandle)) {
    if(!this._Grid.IsGroupRowExpanded(rowHandle)) {

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

csharp
TableViewHitInfo hitInfo = view.CalcHitInfo(e.OriginalSource as DependencyObject);
if (hitInfo.InRow && view.Grid.IsGroupRowHandle(hitInfo.RowHandle)) {
    view.Grid.BeginSelection();

wpf-data-grid-handle-row-double-clicks/CS/RowDoubleClick_CodeBehind/MainWindow.xaml.cs#L48

csharp
return;
if(grid.IsGroupRowHandle(rowHandle))
    MessageBox.Show("A group row has been double clicked.", "Info");

wpf-data-grid-obtain-rows-visible-on-screen/CS/IScrollInfoSample/Window1.xaml.cs#L35

csharp
else
        listBox.Items.Add(grid.IsGroupRowHandle(handle) ? "Group: " + item.Text : item.Text);
}

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

vb
Dim rowHandle As Integer = _Grid.GetRowHandleByVisibleIndex(i)
If _Grid.IsGroupRowHandle(rowHandle) Then
    If Not _Grid.IsGroupRowExpanded(rowHandle) Then

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

vb
Dim hitInfo As TableViewHitInfo = view.CalcHitInfo(TryCast(e.OriginalSource, DependencyObject))
If hitInfo.InRow AndAlso view.Grid.IsGroupRowHandle(hitInfo.RowHandle) Then
    view.Grid.BeginSelection()

wpf-data-grid-handle-row-double-clicks/VB/RowDoubleClick_CodeBehind/MainWindow.xaml.vb#L45

vb
If rowHandle = DataControlBase.InvalidRowHandle Then Return
If Me.grid.IsGroupRowHandle(rowHandle) Then
    MessageBox.Show("A group row has been double clicked.", "Info")

wpf-data-grid-obtain-rows-visible-on-screen/VB/IScrollInfoSample/Window1.xaml.vb#L35

vb
Else
    Me.listBox.Items.Add(If(Me.grid.IsGroupRowHandle(handle), "Group: " & item.Text, item.Text))
End If

See Also

GetRowHandleByVisibleIndex(Int32)

IsValidRowHandle(Int32)

GridControl Class

GridControl Members

DevExpress.Xpf.Grid Namespace