Scrollviewer and grid

Hi there,
i’m trying to make a scrollable list of buttons. I thought to fill a scrollviewer with a grid cointaining all the buttons. The problem is that a can’t make the scrollviewer to scroll.
Here is my PG: https://playground.babylonjs.com/#FS6S0L#4

Any suggestion?
Thank’s in advance.

Hi @Mercurio!

  1. I removed your “rgrid” Rectangle because your Tree is like: Scrollviewer > Rectangle > Grid > Buttons.
  2. Grid seems to need have a set value for its height to make it scrollable! I just used your RowDefinition value of “40” like this after you created all buttons:

grid.heightInPixels = grid.rowCount*40;

of course you could store the heightInPixels in a variable (just refactor my example)!

Here is the pg:

2 Likes

Thank you so much.
Yes, rgrid was a test: the Tree is exactly what you mentioned.
Now i understand…i have always to set the height in pixel.
:+1:

1 Like