Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
855
When to Resize With Visible Columns Option
posted

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?

Parents
No Data
Reply
  • 469350
    Suggested Answer
    Offline posted

    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.

Children