We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Programatically do grouping, and detect user-grouping

Hi, I''d like to programatically setup the grouping grid to group by a given column. How is this done?! Also, I''d like to detect when the user alters the grouping manually by dragging a column header; what event fires when this happens? The reason for the second request, is that when I set TableDescriptor.ChildGroupOptions.ShowCaptionSummaryCells = true, the grouped row containing the +- icon needs its width increased to show the group text; I need to do this programatically in response to the grouping changing. Thanks, D.

2 Replies

Administrator October 7, 2004 10:09 AM UTC

To programmitically group by a column, you add the column to the GroupedColumns collection. this.gridGroupingControl2.TableDescriptor.GroupedColumns.Add("Col2"); To ne notified of the user do a grouping, you can subscribe to the GroupedColumns.Changed event.
private void GroupedColumns_Changed(object sender, ListPropertyChangedEventArgs e)
{
	SortColumnDescriptor dc = e.Item as SortColumnDescriptor;
	Console.WriteLine(dc.Name + " "  + e.Action.ToString());
}

DM Dominic Morris October 8, 2004 05:16 AM UTC

Thanks Clay! >To programmitically group by a column, you add the column to the GroupedColumns collection. > >this.gridGroupingControl2.TableDescriptor.GroupedColumns.Add("Col2"); > > >To ne notified of the user do a grouping, you can subscribe to the GroupedColumns.Changed event. >
>private void GroupedColumns_Changed(object sender, ListPropertyChangedEventArgs e)
>{
>	SortColumnDescriptor dc = e.Item as SortColumnDescriptor;
>	Console.WriteLine(dc.Name + " "  + e.Action.ToString());
>}
>
Loader.
Live Chat Icon For mobile
Up arrow icon