I have a MultiColumnListView for which I want to call ResizeToFit programmatically.
Apparently I need to access the MultiColumnHeader object, which should be a child of the MultiColumnListView.
I’ve already tried accessing it via MultiColumnListView.Children()
, but that just returns an empty collection.
In the UI Toolkit debugger I can see that MultiColumnHeader is indeed a child of MultiColumnListView, but I somehow can’t access it.
How can I do this?
Hello!
Currently, ResizeToFit is more of a functionality for the user looking at the view, and not to be done programmatically. To achieve the same behaviour, you’d just need to set the columns to be stretchable and it should have the same effect.
Maybe your use case was missed though. Can I ask how you’d use this?
ResizeToFit seems to calculate the width of the column depending on the type, which I like much better. See for yourself:
column.stretchable:

ResizeToFit:
