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
close icon

Resize Columns To Fit GGC

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.

4 Replies

AD Administrator Syncfusion Team 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.
GGCResizeTofit.zip

Best regards,
Haneef


VO VoxCode February 28, 2007 04:06 AM UTC

Thanks, that seems to do the trick.


VO VoxCode 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?


AD Administrator Syncfusion Team February 28, 2007 11:02 PM UTC

Hi Joel,

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

Best regards,
Haneef

Loader.
Live Chat Icon For mobile
Up arrow icon