Skip to main content

Notifications

Power Apps - Building Power Apps
Answered

Flexible Height Gallery Overlap

Posted on 22 Nov 2024 19:00:55 by 603
Given that I have this working in one app and can't get it to work in a second is more than a little maddening.
I simply can't figure out why it thinks that the row in the gallery is a bunch of pixels above where it actually is.
 
Here is a snip of the problem:
 
That blue separator bar should be the lowest point in the row. It's height is fixed and it's Y is some number of pixels below one of two controls based on visibility. And it's landing in the right place even though I didn't share a snippet of the lower row. That number is a text control that sums up all of the control heights to tell me how tall the row is. Although I don't have one in this gallery, I normally have a rectangle on the left that indicates selection. The controls that are not visible each have If statements that collapse their height to 0 if not visible which I know is working because the next row has a value of ~331 because two other controls are visible in the next row.
 
What I don't understand is why it puts that very first label, which is at Y=2 in the middle of the gallery row above it.
 
I initially thought it was because a couple of labels had fixed or auto-height but changing that doesn't change anything and not one control in my working gallery has auto-height on. They are all defined with static or variable values based on some calculation.
 
So I'm at a complete loss.
 
Any ideas what to check?
Categories:
  • Verified answer
    DCHammer Profile Picture
    DCHammer 603 on 25 Nov 2024 at 19:21:13
    Flexible Height Gallery Overlap
    Multiple days and hours of effort and it's definitely a bug.
     
    So, after my last comment stating that I was sure it was in the app itself and not the gallery, I examined settings between the app with the problem and one without.
    The app with the problem had Scale to Fit on in the App settings so I turned it off. The sizing of the app went completely wonky because it was built manually and not using containers.
    But, what was interesting is that it sized the gallery rows correctly.
    So I chose to make one control inside that test set have conditional visibility so that row heights would fluctuate.
    And it rendered that correctly even though the entire app scaling was completely messed up.
    So on a lark, I thought I'd turn Scale to fit back on and see if the gallery still rendered correctly.
     
    And... it does.
     
    Marking it resolved so that if someone stumbles across this, they know what to try.
     
    tldr;
    Toggle the Scale to fit on and off and see if it starts rendering correctly.
  • DCHammer Profile Picture
    DCHammer 603 on 25 Nov 2024 at 18:58:58
    Flexible Height Gallery Overlap
    Well, I'm able to reproduce this problem at will now. Unless someone can explain to me what property I'm not using correctly that is leading to this behaviour, I'm left with no other conclusion to draw other than there is currently a bug with both the Modern and Classic flexible height gallery controls.
     
    Here is the test:
    Insert a flexible height gallery. Connect it to the data source of your choice.
    Insert just four controls:
    A 2px rectangle at X=0, Width = Parent.Width
    A label with the data of your choice from the datasource. Y=2. Width = Parent.Width. Height = 17 (you could likely change the height without effect.
    A label with data of your choice from the datasource. Y=Label1.Y + Label1.Height. Width = Parent.Width. Height = 29(you could likely change the height without effect.
    A button with data of your choice from the datasource. Y=Label2.Y + Label2.Height. Width = Parent.Width. Height = 30.
     
    This will display correctly in the Editor when you press the Alt key and it will display correctly if you click the Preview app button.
     
     
    Well, well. Just before I clicked Post, I decided to try one more test.
    If I do the test detailed above in a brand new empty app, the gallery behaves correctly. But when I do this in a pre-existing app, no matter which flex height gallery I choose, the test fails.
     
    So, I now know there is some old reference in this app causing the gallery to not render correctly. The questions are:
    1. Can I find it at all and modify it so the app behaves?
    2. If I can't find it, will it somehow follow along if I try and recreate the entire app in a new empty app by starting with a blank canvas and copying and pasting controls?
     
     
  • DCHammer Profile Picture
    DCHammer 603 on 22 Nov 2024 at 21:20:12
    Flexible Height Gallery Overlap
    To answer the padding question, it's 0.
     
    And as far as I can tell, this is definitely a bug. If you want to try and prove me wrong, I'm more than happy to be told so.
     
    Create a Blank Flexible height gallery.
    Put a 2 pixel rectangle at the top so you can see where PA thinks the row begins.
    Add three labels.
    Put the first at Y=0.
    Put the second at Label1.Y + Label1.Height
    Put the third at Label2.Y + Label.Height
    Add a button.
    Set it's Y to Label3.Y + Label3.Height
    Add a text input control.
    Set it's Y to Button.Y + Button.Height
     
    Publish it and check.
     
    You'll get something like this:
     
     
     
  • DCHammer Profile Picture
    DCHammer 603 on 22 Nov 2024 at 20:08:47
    Flexible Height Gallery Overlap
    @MarkRahn That was a great lesson so thanks. But I'm no closer to solving the problem. Although it does let me eliminate possible reasons for the problem happening quicker so thanks for that.
     
    I just don't understand what it's doing.
     
    To eliminate the possibility that non-visible controls are causing my problem. I removed all of the conditions affecting visibility and just show everything. The same problem still exists.
     
    My rowHeight calculation works out correctly and I know that because the Y for that label is Value(Self.Text) - Self.Height. And it's rendering right at the bottom of the gallery row where I expect it too. And given that the Y is essentially manually set, it should be the lowest thing in the row.
     
    I'm seriously considering hiding this gallery and creating a new one from scratch, one control at a time to see where it breaks if I can get it to.
  • ronaldwalcott Profile Picture
    ronaldwalcott 734 on 22 Nov 2024 at 19:57:59
    Flexible Height Gallery Overlap
    What is the padding bottom size?
  • MarkRahn Profile Picture
    MarkRahn 801 on 22 Nov 2024 at 19:51:12
    Flexible Height Gallery Overlap
    Hi  
     
    I don't know if this will help or not. I have been in a similar situation. Trying to adjust controls in a gallery to get things to line up properly and dynamically.
     
    One thing that might help is to find the Gallery and click on "View Code"
    This will give you all the settings for your controls in one place. You might see something in the X or Y settings that stands out on why things are not working the way you want to. It at least gives you a view where you are not going from one control to the next trying to figure out the "Why is this not working".
     
    If I've answered your question or solved your problem, please mark this question as answered. This helps others who have the same question find a solution quickly via the forum search. If you liked my response, please consider giving it a Like.
     
    Thanks
    -Mark
     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

October 2024 Newsletter…

October 2024 Community Newsletter…

Community Update Oct 28…

Power Platform Community Update…

Tuesday Tip #4 How to Conntact Support…

Welcome to a brand new series, Tuesday Tips…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 143,111

#2
RandyHayes Profile Picture

RandyHayes 76,308

#3
Pstork1 Profile Picture

Pstork1 63,795

Leaderboard