How can I reset row grouping programmatically ? The following statement does nothing:
if (ultraGrid1.Rows.IsGroupByRows) ultraGrid1.DisplayLayout.ResetGroupByBox();
ultraGrid1.DisplayLayout.ViewStyleBand = ViewStyleBand.OutlookGroupBy;
ultraGrid1.DisplayLayout.Override.AllowGroupBy = DefaultableBoolean.True;
Thank for a hint
Kagel
What do you mean by "reset row grouping"?
If you mean that you want to programmatically ungroup any columns that were grouped, you can loop through all columns in all bands of your grid, and set the IsGroupByColumn property to false.
If you want to do this more efficiently, you can instead go through the SortedColumns collection on each band, and set IsGroupByColumn to false on each of these columns. You can do this because grouping by a column implicitly sorts it. If you do this, you should loop through the collection "backwards," since removing the grouping will modify the collection. Below is the approach I'd use (note that I haven't tested this so it may need further modification)
using Infragistics.Win.UltraWinGrid;...foreach (UltraGridBand band in grid.DisplayLayout.Bands){ for (int i = band.SortedColumns.Count - 1; i >= 0; i--) { UltraGridColumn col = band.SortedColumns[i]; col.IsGroupByColumn = false; }}
of course, I'm talking about to ungroup programmatically the rows
unfortunatly the property IsGroupByColumn' can't be set :
Error 1 Property or indexer 'Infragistics.Win.UltraWinGrid.UltraGridColumn.IsGroupByColumn' cannot be assigned to -- it is read only
Error 1 Property or indexer 'Infragistics.Win.UltraWinGrid.UltraGridColumn.IsGroupByColumn'
cannot be assigned to -- it is read only
there must be another way....?