Hi. I'm using the WinGrid version 10.2 and have a question about column resizing.
When I load a grid with data, and call:
column.PerformAutoResize(PerformAutoSizeType.VisibleRows);
The columns are sized based on the column header data, not the data in the rows. The columns must resized manually. If I used the AllRows option, the columns resize.
Is there a "trick" to using the .VisibleRows option? Should it only be used during certain grid events?
Hi,
VisibleRows sizes only based on the rows that have been currently loaded and are visible in the grid. This will not work if you call this method before the first time the grid paints, because the grid doesn't create any row objects until it needs to draw them on the screen. So it's generally that useful to call it in code, it's mostly there for the RowAutoSizeMode property so that when the user double-clicks to autosize a row it doesn't force all of the data to load or cause any performance problems.
The AllRowsInBand option, on the other hand, forces the creation of all of the rows regardless of their visibility.
In my experience, unless you are loading your grid data on demand, you are almost always better off using AllRowsInBand, since it's so fast, anyway.
Let me know if you need any additional help.
Regards,
Stefaniya