In the ScrollViewer docs I see the accessor
adaptHeightToChildren listed. However, upon testing it I’m finding it doesn’t do anything. I understand this is one of the more complicated controls, so let me explain my current use case.
- Slide show-esque app that displays text in a Fullscreen UI on top of an interactive 3D scene.
- The amount of text displayed is dynamic based on the author.
- The container must grow and scroll to support larger quantities of text (requires the ScrollViewer).
- The container should only scroll vertically and will have a fixed width.
- Some slides may only have a few words displayed, meaning not much space is required.
- We want as much as the 3D scene to be visible as possible, therefore we want the container to shrink down in size when the full 100% height isn’t required.
I’m essentially wanting the ScrollViewer to adapt its height to the children, but without growing beyond a maximum height. In my case, the maximum height is simply 100%.
Here’s a Playground with my first attempt at creating this functionality. In the playground, you can click the button to change the length of the text.
There are two examples at the bottom of the playground you can view.
Example 1 includes a ScrollViewer and Example 2 excludes it.
What you will find in the examples is that #2 provides the functionality I want, but without scrolling. #1 provides the scrolling, but is always at a fixed height of 100%.
Anyone know of a way I can accomplish this design?