Home Forums WinForms controls Xceed Grid for WinForms Autosize grid column

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #13769 |

    Hi all,

    I have a grid 2.2 where the last column should always be autosized to fit the whole space at the right side so there should not be any empty / unused space. How is this possible? I tried to write a little procedure on my own but could not place this in the load event as it seems that the grids width is not available at this time.

    Imported from legacy forums. Posted by Kai (had 3783 views)

    User (Old forums)
    Member
    Post count: 23064

    You could place it in the Resize-event of the GridControl.

    Imported from legacy forums. Posted by Tommy (had 297 views)

    User (Old forums)
    Member
    Post count: 23064

    Could either of you guys tell me how this is actually accomplished?

    Is it a case of adding up the widths of each other column and taking that off the total grid width to get the width for your “filler” column?

    Will this also fix the issue when a horizontal scroll bar is activated because the size of the grid has been shrunk and you get that additional white space at the far right of the grid?

    regards,

    Mac

    Imported from legacy forums. Posted by Dominic (had 369 views)

    User (Old forums)
    Member
    Post count: 23064

    Hi Mac,

    yes, that’s it. Retrieve the width of the entire grid, subtract all other columns and set the filler column to the rest width. Use also a default minimum in case your grid is too small to display all columns. Placing the function into the resize-event updates the column widths not only on initialization but also when you resize the window (as the even says…. 😉 ). You might do some fine tuning then, actually I did not get it that there is really no white space at the right, currently there are always some pixels, but I did not investigate too much on that….

    Imported from legacy forums. Posted by Kai (had 389 views)

    User (Old forums)
    Member
    Post count: 23064

    In my opinion – columns should allow the user to set the width to -1 which causes that column to auto-fill the entire available grid (client) width.

    Or perhaps on the grid itself, offer an “AutoSizeColumn” property – which would present the user with a list of all columns in the grid…The developer would pick from this list which column to auto-size (top entry being <none> of course)

    Want to really get fancy?

    How bout allowing percentages for column widths? That would you could identify specific pixel width for some columns while setting more-than-one column to auto-size according to their percentage setting.

    Of course, this is just my opinion. I could be wrong 🙂

    -LK

    Imported from legacy forums. Posted by Curtis (had 5044 views)

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.