I am adding a group programmatically right after I databind using the one line of code below.
this
.ugDataGrid.DisplayLayout.Bands[0].Groups.Add("KEYNAME");
I then need to be able to hide the group by box and be able to nagivate the bands. Is there an an option? If an option does not exist, then I want to lock the group (user should not be able to ungroup or group other columns).
Hi,
To hide the groupby area you just need to do the following:
this.ugDataGrid.DisplayLayout.GroupByBox.Hidden = true
I am thinking I might be doing something worng. When I add the group my dada was disappearing in the grid. Sorry, I forgot to mention that. Hiding the group box was never a problem. I can see the datatable having that column with data. But, by performing the Group.Add, the column is not inside the GroupBox and ofcouse the data that is bound to the grid no longer getting displayed. Basically at the end I am trying to programmatic grouping of columns after the databinding takes place.
Thanks. That is exactly what I needed.
I'm not sure what you mean when you say "by performing the Group.Add". If you are using the band.Groups.Add method, then that has nothing to do with the OutlookGroupBy feature which groups rows in the grid. Those groups are for grouping columns. So if you are adding a Group to the band, you will end up seeing a group header with no columns (since you are not adding any of your columns to this group.
To group rows programmatically, you need to use the band.SortedColumns.Add method and specify true for the (optional) groupBy parameter.