Nope, no quick fix. You would need to loop over all the data and find the longest strings. You would then need to calculate the widths based on FontMetrics for the font you are using.
I have seen an example in the past so Google should be your friend. --- In [email protected], "kg_andrew21" <grizzly33@...> wrote: > > Hey guys, > > this is my first post, I tried searching for the issue but came up with no > matches, so I hope it won't be a duplicate. > > So what I want to do is this: have a DataGrid that has all its column's width > set to the greatest of these 2 values: its typicalItem's width (which without > specified is the dataProvider's first item) or the headerText's width so that > the headerText will not get cut off. > Currently the problem is that if the typicalitem's width is smaller than the > headerText than the headerText is cut off, but I don't want that, I want > headerText to be fully displayed in all of my columns. > > What I can do is set the minWidth on each of the columns manually so that the > headerText will surely not get cut off. This works perfectly but its a lot of > pain to do that by hand. So my question is is there a method or quick fix to > prevent headerText to be cut off? One solution that I think could work is to > determine the width that's required by the headerText and set minWidth to > that for that column. > > thanks, > Andrew >

