cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Owizardo
Level: Powered On

Powerapps - How to set dynamic height of a gallery in a canvas app

Hello, 

 

I have a canvas app with 2 flexible galleries, layed one on top of the other. One of my galleries can have about 1 - 50 items in it, where it can contain small to large amount of texts / paragraphs. What im trying to achive is simply to allow a single page scroll instead of 2 seperate scrolling areas. 

 

In each of my galleries I have a label text set to auto height. I then set the template_size of my gallery to: 

Label_Text_In_My_Gallery.Height * CountRows(My_data)  

I then set my data card's height to the height of my galleries:

Gallery1.Height + Gallery2.Height

While this in theory would work, however it seems that Powerapps only calculates the first item in the gallery and the rest is ignored.

 

For example, lets say my first Item has very large text with 5 paragraphs. My second item in the gallery only has one paragrah of text. Well powerapps seems to set my second item (and all the remaining items) to the size of the first item (5 paragraphs) or vice versa. So this is creating alof of blank space. 


Has any come across this issue and know of a work around? I would really appreciate some feedback on this.

 

1 ACCEPTED SOLUTION

Accepted Solutions
Microsoft Employee

Re: Powerapps - How to set dynamic height of a gallery in a canvas app

Hello @Owizardo,

Please note that the flexible height gallery was designed to estimate the content size and to adjust its height accordingly. You shuold never be setting the tepmlate size of the flexible height gallery.

Have you tried setting both auto-height enabled labels in a card? I think that by doing this, you shuold be able to have both labels on top of each other and have a single scroll.

 

View solution in original post

2 REPLIES 2
Microsoft Employee

Re: Powerapps - How to set dynamic height of a gallery in a canvas app

Hello @Owizardo,

Please note that the flexible height gallery was designed to estimate the content size and to adjust its height accordingly. You shuold never be setting the tepmlate size of the flexible height gallery.

Have you tried setting both auto-height enabled labels in a card? I think that by doing this, you shuold be able to have both labels on top of each other and have a single scroll.

 

View solution in original post

bryan_0226-ag
Level: Powered On

Re: Powerapps - How to set dynamic height of a gallery in a canvas app

Once you have the DataCard1 and Gallery1 (inside of DataCard1) created, I got it to work using the following:

 

Step 1:

Set the Gallery1.Height=Separator1.Y*Count(Gallery1.AllItems.ID)+20.

 

The "ID" portion likely depends on the items you are referencing. The sharepoint list I am using as an ID field. Basically this took the Y-height of my separator line and multiplied it by the number of items in the gallery. The "+20" at the end was to give me a little extra space at the end of the gallery to make sure it fit.

 

Step 2:

Set the height of DataCard1=Gallery1.Height.

 

This auto-heights the datacard to expand or shrink depending on the number of items in the gallery.

 

I did not touch the Gallery1.TemplateSize property.

 

To get Gallery1 inside of DataCard1, this person figured it out: https://powerusers.microsoft.com/t5/PowerApps-Ideas/Insert-Gallery-and-Forms-component-into-Scrollab...

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors (Last 30 Days)
Users online (6,337)