cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper II
Helper II

Setting Flexible Gallery Height inside Scrolling Canvas to remove gallery scroll wheel?

I have a form and a few galleries set inside a scrollable canvas, all vertically stacking. While two of the galleries have small values and a flexible gallery isn't necessary, another has a multi-line value, which requires a flexible gallery. I can remove the gallery scrolling in the non-flexible galleries using the formula: CountRows(GalleryName.AllItems) * 'X' ( where 'X' varies as needed), but how does one derive such a formula for a flexible gallery?  

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Helper II
Helper II

Setting the overall height of a flexible gallery doesn't seem to have any straight forward resolve. There should just be an Autoheight option for the gallery so it can be set inside scrolling screens and other galleries. 

 

My workaround for this, until that occurs, was to add a hidden label in the gallery, behind the label with the auto-height text appearing, ensuring it is the same width and padding, text size, etc.. I called this label 'NoRows', and added to its Text field: 

(Len(TheLabelwithAutoHeightText.Text)/75)*1.2

My understanding is that this is counting the text, dividing it by the number of characters (in my case approx. 75), and multiplying it by the line-height.

 

Then changing the gallery height to the below"

Sum(Gallery.AllItems,NoRows) * 30+10

where (30) is essentially the padding around the label. This gave a much closer result, with some detail pages just short or long a bit, but the large differences are gone. Adding a bit more to the end (+10) helped ensure the scroll would disappear. 

 

View solution in original post

5 REPLIES 5
Highlighted
Super User
Super User

The way I adjust a flexible gallery is to use the separator or a rectangle (to look line a line) placed at the bottom of the row.   Then I set the Label that has multiple lines to Auto Height.  Then in the y property to the Rectangle or separator set it to label?.Height + 40

 

This keeps the line 40 below the label no matter what height it is ( one or more lines).  I then adjust the row to bottom of the rectangle.

Highlighted

@leyburn19  thanks for your response. I'm referring to the overall height of the flexible gallery, not the individual rows. I have a flexible gallery sitting within a scrolling canvas, with other non-flexible galleries above and below it. I need to adjust the Height property of the flexible Gallery to some formula, so the scroll wheel of the flexible gallery disappears. This is straight forward with non-flexible galleries, but how to do it with a flexible gallery? Thanks.

Highlighted

Hi @dsgnmind ,

 

Why set a formula for the height? if you are confident about the data and the height of each Datacard (rows in gallery) ! simply set the height of the Gallery and then turn off the Show Scrollbar for the gallery.

if not you want to set the height of the gallery with formula only, here is the formula:

Gallery11.TemplateHeight * CountRows(Gallery11.AllItems)

I hope this resolved your issue if you see any challenge let me know I am always happy to help.

Regards,

Krishna
If this post helps, then please consider Accept it as the solution and give thumbs-up to help the other members find it more.


I hope this resolved your issue if you see any challenge/need further help please let me know I am always happy to do it for my community.

Proud to be a Super User!

Regards,
KrishnaV
Business Applications MVP
Twitter | Linkedin | YouTube | GitHub
If this post helps you give a 👍 and if it solved your issue consider Accept it as the solution to help the other members / new members of the community.
Highlighted

@KrishnaV As stated, the flexible gallery in question sits in a scrolling canvas with another (non-flexible) gallery above and below it. I want all the records in the flexible gallery to appear and push the cards below the flexible gallery card down, and not have a second scroll just for the flexible gallery. Approaches using formulas CountRows(GalleryName.AllItems) * 'X'  or Gallery11.TemplateHeight * CountRows(Gallery11.AllItems) only work in non-flexible galleries, where all the rows are the same height. They don't work for a flexible gallery because of the number of rows and their heights change (flexible).  One ends up with white space at the end of the flexible gallery, or with a scroll depending on how many rows are associated with the record.  How does one make the overall height of a flexible gallery adjust according to the flexible row heights?

Highlighted
Helper II
Helper II

Setting the overall height of a flexible gallery doesn't seem to have any straight forward resolve. There should just be an Autoheight option for the gallery so it can be set inside scrolling screens and other galleries. 

 

My workaround for this, until that occurs, was to add a hidden label in the gallery, behind the label with the auto-height text appearing, ensuring it is the same width and padding, text size, etc.. I called this label 'NoRows', and added to its Text field: 

(Len(TheLabelwithAutoHeightText.Text)/75)*1.2

My understanding is that this is counting the text, dividing it by the number of characters (in my case approx. 75), and multiplying it by the line-height.

 

Then changing the gallery height to the below"

Sum(Gallery.AllItems,NoRows) * 30+10

where (30) is essentially the padding around the label. This gave a much closer result, with some detail pages just short or long a bit, but the large differences are gone. Adding a bit more to the end (+10) helped ensure the scroll would disappear. 

 

View solution in original post

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Community Highlights

Community Highlights

Check out the Power Platform Community Highlights

Top Solution Authors
Top Kudoed Authors
Users online (11,120)