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
925
ResizeAllColumns combined with ExtendLastColumn
posted

The column sizing behavior I want is that when the grid first loads the columns are equally sized and filling the whole width. From that point on the user can resize any of the columns.

The problem with ResizeAllColumns is that when the user resizes a column all other columns are resized to accomodate the change, this isn't what I would expect as it makes it not possible to go from left to right resizing all the columns to the desired width (as the first column will be resized when you change the 2nd etc).

I tried starting with ResizeAllColumns and then changing to ExtendLastColumn once the grid had loaded, but I couldn't get this to work (perhaps I was doing it at the wrong time?)

What I'm left with now is using ExtendLastColumn but on the initializeLayout event manually setting the widths of the columns. I was just wondering if there is a built-in way to achieve what I want?

  • 69832
    Verified Answer
    Offline posted

    fluxmunki said:
    I tried starting with ResizeAllColumns and then changing to ExtendLastColumn once the grid had loaded, but I couldn't get this to work (perhaps I was doing it at the wrong time?)

    Yes, that's what I was thinking; more than likely this is a timing issue. I tried setting AutoFitStyle to 'ResizeAllColumns' in response to InitializeLayout, then overriding the form's OnHandleCreated and using BeginInvoke to call a method that sets AutoFitStyle to 'ExtendLastColumn', and it seemed to work.