Home › Forums › WinForms controls › Xceed Grid for WinForms › Autosizing columns
Is there a method at autosize the column widths so they fit the contents?
Imported from legacy forums. Posted by Paley (had 3672 views)
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)
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)
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)
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.
Imported from legacy forums. Posted by rherin (had 4458 views)