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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Resize Columns To Fit GGC

Thread ID:





57156 Feb 27,2007 06:18 AM UTC Feb 28,2007 11:02 PM UTC WinForms 4
Tags: GridControl
Asked On February 27, 2007 06:18 AM UTC

I'd like to add a command to my app that will cause the columns in a GridGroupingControl to resize to fit the max length of the text in each column (just like it does when you first bind to the data source).

I have tried the ResizeToFit method but cannot get it to work.

I want to resize every column in the grid.

Administrator [Syncfusion]
Replied On February 27, 2007 03:31 PM UTC

Hi Joel,

Try including this flag in the GridResizeToFitOptions, IncludeCellsWithinCoveredRange.

this.gridGroupingControl1.TableDescriptor.AllowCalculateMaxColumnWidth = false;
this.gridGroupingControl1.DataSource = dt;
this.gridGroupingControl1.TableModel.ColWidths.ResizeToFit(GridRangeInfo.Table(),GridResizeToFitOptions.IncludeCellsWithinCoveredRange|GridResizeToFitOptions.IncludeHeaders );

Here is a sample.

Best regards,

Replied On February 28, 2007 04:06 AM UTC

Thanks, that seems to do the trick.

Replied On February 28, 2007 04:51 AM UTC

On further examination the suggested code does not shrink the columns if they are too large even though the NoShrink flag is not set.

Any idea how to correct this?

Administrator [Syncfusion]
Replied On February 28, 2007 11:02 PM UTC

Hi Joel,

Your incident #32257 has been updated. Please refer the incident for more details.

Best regards,


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon