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

auto-fit column width and auto-wrap to multiple rows

Hi,
V4.4.0.51 & VS2003

In form with GGC, there are situation with a lot of columns such as 30 fields(or columns) for a record. I want to add two option buttons to automatically to change the grid layout.

1. button for Auto-fit-content width
click this button, it will automatically to adjust all columns' width to fit its content.

2. button for Auto-Wrap-to-multiple- rows
click this button, first, it will adjust all columns' width to fit its content. then it will wrap a record row to multiple lines to make all columns visible.

Do you have any built-in property or methed to this? Any samples?

Thanks,

Lan

1 Reply

HA haneefm Syncfusion Team April 26, 2007 05:19 PM UTC

Hi Lan,

Issue 1:

You can try this code snippet to resize the column-width to fit its content

this.gridGroupingControl1.TableModel.ColWidths.ResizeToFit(GridRangeInfo.Table(),GridResizeToFitOptions.GridResizeToFitOptions.IncludeHeaders );

Issue 2:
One comment is that by default, the GridGroupingControl does not support rows with individualized rowheights. To get this support, you need to add a custom GridEngine as in the ResizableRows browser sample( \Essential Studio\4.4.0.49\windows\Grid.Grouping.Windows\Samples\FeatureSamples\ResizableRows ). The ResizableRows browser sample also shows you how to implement the IGridRowHeight interface and its routines for getting and setting row heights for elements.

Once you have this, then you can call TableControl.Model.RowHeights.ResizeToFit to handle either of these cases. Here is a little sample.
http://www.syncfusion.com/Support/user/uploads/GGC_Forum_ResizeToFit_a41fcf80.zip

Best regards,
Haneef

Loader.
Live Chat Icon For mobile
Up arrow icon