Measuring child with Infinite or Available height in Auto mode #30334
Unanswered
Ranjith-RKD
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi folks,
I'm building a custom Expander control that can contain multiple children — for example, a ScrollView or a Grid, each holding a Label.
Now, suppose the Expander is placed inside a parent with a fixed size, say Width=500 and Height=500.
When measuring its children, if I pass infinity, then controls like ScrollView or Grid (with a multi-line Label inside) often return only the space they need — say 50 in Width.
But if I measure them with 500, they report 500 — the full available size — even if they only need a small portion.
That seems counterintuitive — you’d expect infinite size to result in larger measurements, not smaller.
This behavior leads to layout confusion. For example:
But when I place a ScrollView or Grid inside my Expander, if the Expander measures with infinity, it ends up getting a small size like 50.
If it measures with 500, it gets 500 — even when the child doesn't need that much space.
What should I do — measure with infinity, or report this as an issue?
Beta Was this translation helpful? Give feedback.
All reactions