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

You could try this (untested code):
grid.GroupingUpdated += new EventHandler(grid_GroupingUpdated);
void grid_GroupingUpdated(object sender, EventArgs e)
{
List<string> lListGroupColumns = new List<string>();
foreach(Group g in grid.GroupTemplates)
if (!string.IsNullOrEmpty(g.GroupBy))
lListGroupColumns.Add(g.GroupBy);

foreach(Column c in grid.Columns)
c.Visible = !lListGroupColumns.Contains(c.FieldName);
}

Imported from legacy forums. Posted by Tommy (had 320 views)