Setting column width on GGC

Hi Guys,

I have a GridGroupingControl with a single column. I want to set the column width so that it spans the entire width of the grid. I thought this should be a simple exercise, but it is not.

So far, I have tried:

myGrid.TableModel.ColWidths[0] = myWidth;

myGrid.TableDescriptor.Columns[0].Width = myWidth;

myGrid.TableModel.ColWidths.ResizeToFit(GridRangeInfo.Table());

I have tried all of the above statements, and none of them seem to work no matter what the following setting is:

myGrid.TableDescriptor.AllowCalculateMaxColumnWidth = true; // false doesn't work either!

I also thought I'd try the example here...

http://www.syncfusion.com//support/kb/grid/Default.aspx?ToDo=view&questId=70

But the attached code and example is for a GridDataBoundGrid not a GridGroupingControl.

So - can Syncfusion please tell me - What is it that I need to do to get my single column width to span the entire grid?

Regards,
Russell

1 Reply

AD Administrator Syncfusion Team May 25, 2007 08:30 AM UTC

Try this code.

grid.TableDescriptor.Columns[0].Width = grid.ClientRectangle.Width - grid.TableOptions.RowHeaderWidth - SystemInformation.VerticalScrollBarWidth;


Here is a little sample.

WindowsApplication315.zip

Loader.
Up arrow icon