GGC ResizeToFit when grouped on form_load

I am having a problem with ResizeToFit if I add grouped columns in form_load. If I include these statements: .GroupedColumns.Add("Status",ListSortDirection.Descending) .GroupedColumns.Add("LastActivityDateAsDate", ListSortDirection.Ascending) This resizetofit call resizes badly: .ColWidths.ResizeToFit(GridRangeInfo.Table.ExpandRange(1, 1, .RowCount, .ColCount),GridResizeToFitOptions.None) I''ve tried different resizetofitoptions but none seem to make a difference. The same statement resizes correctly if the grid is loaded ungrouped and the user groups it. I am calling resizetofit in the FormSizeChanged and CategorizedRecords events. Is there anyway to add grouped columns later than at the end of form_load? Thanks, Dave Erwin

3 Replies

AD Administrator Syncfusion Team November 29, 2005 04:50 PM UTC

>>Is there anyway to add grouped columns later than at the end of form_load? At the end of form.load, you can create a Timer with a small interval and a Tick event. In the event handler, stop the timer, unsubscribe to the event and do the grouping there.
//At the bottom of form.load
Timer t = new Timer();
t.Interval = 20;
t.Tick += new EventHandler(t_Tick);
t.Start();

//the handler
private void t_Tick(object sender, EventArgs e)
{
	Timer t = sender as Timer;
	t.Stop();
	t.Tick -= new EventHandler(t_Tick);
	t.Dispose();

	//do your grouping and sizing;
}


AD Administrator Syncfusion Team November 29, 2005 05:27 PM UTC

Thanks, I''ll give that a try. Is there a reason why resizetofit behaves this way? Dave Erwin


AD Administrator Syncfusion Team November 29, 2005 06:09 PM UTC

The GridGroupingControl has does its own resizing the very first time the grid is about to be drawn. I suspect this resizing is stepping on the resizing you are trying to do.

Loader.
Up arrow icon