@TiagoFreire wrote:
Or even better, you can go:
CountRows(YourGalleryName.AllItems)*(YourGalleryName.TemplateHeight)
This way, you get the flexibility of being able to modify your gallery template, and it will still work.
Hi @Anonymous,
I would advise you to use this pattern as @TiagoFreire suggested.
The basic concept of this sultion is that the gallery height will be determined by the number of items shown in the gallery multiplied by the height of a single item (the template height).
Because the height of your gallery is now flexible it can mean that in case of a lot of items the height could become bigger than the available space and a part of the gallery would not be visible because it would be outside the screen bounderies. For that you need to add a some logic to maximize the height of the gallery to the available space.
There are multiple ways to do this. One example is to use this formula for the gallery height property:
If(
CountRows (YourGalleryName.AllItems) * (YourGalleryName.TemplateHeight) > AvailableSpace,
AvailableSpace,
CountRows (YourGalleryName.AllItems) * (YourGalleryName.TemplateHeight)
)