Hello! I have a ScrollView with items and these items contain an x number of child items. I’m trying to make these child items collapsible with animation. The problem is that if I don’t define a preliminary height for the child items, the animation doesn’t work. So far I figured to make this work by calculating the height of the child items in JS (by knowing the number and height of the children), but I was wondering is there a more robust way to make this in UX?
there is a height()UX expression function available that you could use in UX. Alternatively, you could couple a LayoutAnimation with a changing LayoutRole - look those up in the docs.
Thank you! I tried replacing Height=“160” with Height=“height(this)”, but there was still no animation. Is this because the child items are not populated yet?
You should use the height() expression to measure the height of an element that only holds the items you want to show/hide; a nested StackPanel maybe? And you should only use it on a Change modifier, so that the calculation happens when you actually need to deviate from the rest state.