I've created a gallery inside a canvas element. Each gallery element contains several elements to display. I want to calculate the sum of the height of all gallery items to set the number for the Height-Attribute of the gallery.
The gallery should be shown with full height and I want to use this inside a gallery element to add other items below the gallery.
Solved! Go to Solution.
You can add a label in your MyGallery. Let's name it LabelRecordSum.
This label will show the sum of the labels' heights
Now outside of your gallery create a label ---> LabelSum
Now you can set:
LabelRecordSum.Visible=false and it's hidden from the user but still does what you need.
I hope it's good enough for you.
Each control has an X value and Y value. So you can sum the total of the controls Y values to set your size.
If you add a control to the page you will see that data cards are done this way automatically. This would give you a working example.
thank you for your reply. I'm aware of the X and Y property but do not know how to sum all items of the gallery.
In my case it will look something like this:
- label 1 (Height 10)
- label 2 (Height 10)
- label 3 (Height 20)
- label 4 (Height 20)
So the sum has to be 60 for the gallery.
These elements are "HTML text" controls and their height depends on the content. If the elements where all the same height, I would just Count the rows and multiply by a value. This is the problem I ran into.
I've tried something like this: ForAll( MyGallery.AllItems, predefinedVar + This.Height). So basically I thought I can add each item height to a given variable.
Learn how to create your own user groups today!
Check out the new Power Platform Community Connections gallery!
Congratulations, the new Super User Season 2 for 2021 has started!
Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.