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


Why cannot change the width of a column at design time?

5 Replies

AD Administrator Syncfusion Team February 3, 2004 01:03 PM UTC

You can for a GridControl, but cannot for a GridDataBoundGrid. The GridBoundColumns which you have access to at design time for a GridDataBoundGrid, do not have a Width property associated with them. You can derive GridBoundColumn and add a Width property to it. Here is a sample that adds such a property, the CustomGridBoundColumn.Width, that can be used both design time and runtime as long as it is not zero. It has a Northwind datasource set in the designer, so you may have to tweak that to get it to run on your system. It does so by listening to the Model.QueryColWidths event, and if there is a non zero width value in a column, it provides it in this event. Subscribing to the event is a little problematic in that you cannot do it in the grid''s constructor as the Model is not fully functional at that point. So, this sample uses an OnPaint override to subcribe with a flag set to to repeatedly subscribing. There may be a better place to put this, but this seems to work.

ME Marco Ensing February 4, 2004 01:23 AM UTC

Clay, Thanks for the example. Is this going to be part of the 2.* release ? What would be really nice if the column width would persist state. Something similar as the docking control. I tried to set the QueryColWidth() but then the user can not re-size the columns later on. Or the values will not be restored the next time. Marco

AD Administrator Syncfusion Team February 4, 2004 06:30 AM UTC

In the 2.0 GridGroupingControl, you can persist look and feel elements like column width, but the GridBoundColumn used by the GridDataBoundGrid has not been changed yet to include a width property. There are samples in this forum thread that show how you can persist your user''s column order and size at runtime. http://www.syncfusion.com/Support/Forums/message.aspx?MessageID=3918

ME Marco Ensing February 4, 2004 12:32 PM UTC

Tnaks for your reply. Problem with the GridGroupControl is that it is too slow. Originally I made an example with the GridGroupControl, and now I''m changing it to the GridControl. (I know I loose some features) I also ran the syncfusion GripGrouping examples and when I want to switch from the first record to the last record, it takes too long. The gridDataBoundGrid seems to be much more responsive to user interactions. If I''m not mistaken the GridGroupControl is a further specialization of the GridControl. Wonder what other peoples perception is on this issue. Marco

AD Administrator Syncfusion Team February 4, 2004 02:07 PM UTC

The current emphasis for the GridGroupingControl has been the feature set. We have yet to try to optimize it for performance, but that is coming.

Live Chat Icon For mobile
Up arrow icon