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
Highlighted
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.

 

2 REPLIES 2
Highlighted
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.

 

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
firstImage

PowerApps Monthly Community Call!

Join us next Wednesday for our Demo Extravaganza, October 16, 2019 8am PDT.

firstImage

Microsoft Business Applications Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

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

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

SecondImage

Power Platform Summit North America

Register by September 5 to save $200

Top Kudoed Authors
Users Online
Currently online: 352 members 4,979 guests
Recent signins:
Please welcome our newest community members: