Hi there, I've been fiddling around with UIElements and I'm trying to create a settings provider using the new UIElements. However, no matter what I try I cannot seem to make the ListView fill the existing space. See the following example using the UI Builder As you can see in the UI Builder window there are two elements. The first element which is just a simple VisualElement has a margin of 5, padding of 10, and a 1px red border. The second element which is contained within the first element is a ListView and has a 1px green border. Both elements also have flex-grow set to 1. You can find the UXML over here https://gist.github.com/Thundernerd/90cce02cb45170e815862281ad68d280 Hope anyone can enlighten me on how to make the ListView expand and take all available space.
This seems like an issue with the Settings window. It's own container is not set to stretch so, while your elements try to take up all the space inside their parent, the parent settings window container is super tiny. You can verify this using the UIElements Debugger (Window > Analysis > UIElements Debugger).
Yes thank you! I was about to write the same after finding out that the TemplateContainer in the Settings Window does not have flex-grow set to 1. I worked around this by adding a class to the TemplateContainer that enforces this.
You can also use the `myVisualTreeAsset.CloneTree(root)` overload of CloneTree() to instantiate the contents of a UXML template directly inside an element (called "root" in this example), without creating a TemplateContainer.
Just chiming in to say this bug hit me hard as well until I found this post. Using UIBuilder I placed a listview that would be invisible due to height being 0 for the reason you explained a bug. This resulted in hours of troubleshooting until I stumbled upon your answer. Please make this functionality more obvious as all the examples use `var newVisualElement = myVisualTreeAsset.CloneTree()`. It'll save other devs a lot of annoyance and trouble when adopting UIElements.
Same here. I can't get my list view to stretch to fill any space. UI Debugger is just showing blank everything, so that doesn't help. I don't understand why but your fix of adding it to root directly worked, Thanks! But this is very non-obvious. that's 4 hours of my life I'll never get back. Perhaps this can be improved on in a future update.