Hallo
I would like to set the grouping by the column from the code.
Unfortunately, IsGroupByColumn property is read-only.
How can I set the grouping?
Currently I'm trying to do it the following way:
grid.DisplayLayout.Bands[0].Columns[i].IsGroupByColumn
and I get the error
Property or indexer 'Infragistics.Win.UltraWinGrid.UltraGridColumn.IsGroupByColumn' cannot be assigned to -- it is read only
Regards
Hubert
Hi Hubert,
Grouping and sorting are tightly linked. So you need to use the SortedColumns collection on the band. The third parameter to this method specifies whether the column should be grouped.
grid.DisplayLayout.Bands[0].SortedColumn.Add(...)
Would please give us more details.
I would like to group by a column in dynamically in my code by it does not work and give me the same error msg
If you are still getting the same error message listed above, then your code must still be trying to set the IsGroupByColumn property, which you cannot do, because it's not a settable property.
I'm not sure what more more details I can give you here. Here's some sample code that actually groups by a column in the grid called "Int32 1".
private void ultraGrid1_InitializeLayout(object sender, Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs e) { e.Layout.ViewStyleBand = ViewStyleBand.OutlookGroupBy; e.Layout.Bands[0].SortedColumns.Add("Int32 1", false, true); }