Home Forums WinForms controls Xceed Grid for WinForms Hiding columns that are being grouped by Reply To: Hiding columns that are being grouped by

User (Old forums)
Member
Post count: 23064

Works like a charm. Here is the VB.NET (fully tested) version for anyone who’s interested.

Thanks!
Ken

Private Sub grdRecords_GroupingUpdated(ByVal sender As Object, ByVal e As System.EventArgs) Handles grdRecords.GroupingUpdated

Dim GroupByColumns As New ArrayList

For Each g As Xceed.Grid.Group In Me.grdRecords.GroupTemplates
If Not String.IsNullOrEmpty(g.GroupBy) Then
GroupByColumns.Add(g.GroupBy)
End If
Next

For Each c As Xceed.Grid.Column In Me.grdRecords.Columns
c.Visible = Not GroupByColumns.Contains(c.FieldName)
Next

End Sub

Imported from legacy forums. Posted by Ken (had 3423 views)