Home Forums WinForms controls Xceed Grid for WinForms Autosizing columns

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

    Is there a method at autosize the column widths so they fit the contents?

    Imported from legacy forums. Posted by Paley (had 3672 views)

    Xceed Support
    Member
    Post count: 5658

    Hello,

    You can use the column’s GetFittedWidth method. For example:

    myColumn.Width = myColumn.GetFittedWidth();

    Imported from legacy forums. Posted by Jenny [Xceed] (had 347 views)

    User (Old forums)
    Member
    Post count: 23064

    When I try implementing this, the columns are sized to fit only the text in the header row, not the data in the grid. Does the GetFittedWidth method evaluate cells in every row or just the header?

    Imported from legacy forums. Posted by rherin (had 338 views)

    Xceed Support
    Member
    Post count: 5658

    It should evalute the width of every cell in the column and adjust its width to the largest cell. Is this not the behavior you are seeing? What code are you using?

    Imported from legacy forums. Posted by Jenny [Xceed] (had 215 views)

    User (Old forums)
    Member
    Post count: 23064

    I think what’s happening is that I’m calling GetFittedWidth after I have created groups and collapsed the data. When I expand the data first, it behaves as you described.

    Thanks…

    Imported from legacy forums. Posted by rherin (had 4458 views)

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