Articles in this section
Category / Section

How to show the numbered row headers in WinForms GridGroipingControl?

1 min read

Show the numbered row headers

You can number the row headers in the GridGroupingControl by enabling the NumberedRowHeaders property. This property supports only the Header cell type. As the row header of the GridGroupingControl is ColumnHeaderCell cell type, the cell type should be changed to Header to number the row headers. The following code example demonstrates the same.


//Displays the numbered row header.
this.gridGroupingControl1.Appearance.AnyHeaderCell.CellType = GridCellTypeName.Header;this.gridGroupingControl1.TableModel.Options.NumberedRowHeaders = true;



'Displays the numbered row header.
Me.gridGroupingControl1.Appearance.AnyHeaderCell.CellType = GridCellTypeName.Header
Me.gridGroupingControl1.TableModel.Options.NumberedRowHeaders = True


By using PrepareViewStyleInfo Event

Row headers can also be numbered through the PrepareViewStyleInfo event.


//Displays the numbered row header.this.gridGroupingControl1.TableControl.PrepareViewStyleInfo += TableControl_PrepareViewStyleInfo;
void TableControl_PrepareViewStyleInfo(object sender, GridPrepareViewStyleInfoEventArgs e)
    if (e.RowIndex >= this.gridGroupingControl1.TableControl.TopRowIndex && e.ColIndex == 0)
        e.Style.CellType = GridCellTypeName.Header;
        e.Style.Text = GridRangeInfo.GetNumericLabel(e.RowIndex - 2);



'Displays the numbered row header.
Private Me.gridGroupingControl1.TableControl.PrepareViewStyleInfo += AddressOf TableControl_PrepareViewStyleInfo
Private Sub TableControl_PrepareViewStyleInfo(ByVal sender As Object, ByVal e As GridPrepareViewStyleInfoEventArgs)
  If e.RowIndex >= Me.gridGroupingControl1.TableControl.TopRowIndex AndAlso e.ColIndex = 0 Then
     e.Style.CellType = GridCellTypeName.Header
     e.Style.Text = GridRangeInfo.GetNumericLabel(e.RowIndex - 2)
  End If
End Sub


The following image shows the GridGroupingControl with numbered row headers.

 Show the GridGroupingControl with numbered row headers





Did you find this information helpful?
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment