I simply want to have my groupby headers expanded by default to show all their child rows. How do I do this in XAML? Tried searching for this but cant seem to find it anywhere.
Hi,
We currently don't offer that option.
You'd have to do this in the code behind.
-SteveZ
What is the best way to do this in code? I have tried the following:
private void AllergyGrid_InitializeRow(object sender, Infragistics.Controls.Grids.InitializeRowEventArgs e) { if (e.Row != null) { if (e.Row.RowType == Infragistics.Controls.Grids.RowType.GroupByRow) { e.Row.IsExpanded = true; } } } private void AllergyGrid_Loaded(object sender, RoutedEventArgs e) { foreach (Infragistics.Controls.Grids.Row row in ((Infragistics.Controls.Grids.XamGrid)sender).Rows) { if (row.RowType == Infragistics.Controls.Grids.RowType.GroupByRow) { row.IsExpanded = true; } } }
Neither is working.
I'm sorry, i should have provided that code before:
You can use the GroupByCollectionChanged event:
Something like:
private void grid_GroupByCollectionChanged(object sender, GroupByCollectionChangedEventArgs e)
{
if (e.NewGroupedColumns != null && e.NewGroupedColumns.Count > 0)
foreach (Row r in grid.Rows)
r.IsExpanded = true;
}
Hope this helps,
Thanks, that was the next event I was trying.
Still seems to be a problem. The event gets fired before the data is loaded asynchronously. So there are no rows when the event is fired.
private void AllergyGrid_GroupByCollectionChanged(object sender, Infragistics.Controls.Grids.GroupByCollectionChangedEventArgs e) { if (e.NewGroupedColumns != null && e.NewGroupedColumns.Count > 0) { foreach (Infragistics.Controls.Grids.Row r in ((Infragistics.Controls.Grids.XamGrid)sender).Rows) { r.IsExpanded = true; } } }
Hi Yoann,
We haven't added any additional functionality for this yet, so for now your best option is to follow the approach that dkrecker suggested.
Someone can help me please?
I have the same problem, how can I solve it please?
Regards,
Yoann
Hi dkrecker,
I have logged a Feature Request for this functionality, with an ID number of FR12799. I will follow up with you in a private support case.
Thanks,
I ended up just creating my own event. I raise it when data has finished loading from my viewmodel and handle it in my view.
Doing something as simple as defaulting my groups to expanded should not require this.