Skip to main content

Notifications

Power Apps - Building Power Apps
Unanswered

How to create auto height for containers

(0) ShareShare
ReportReport
Posted on by 11

Hi I am struggling with an idea, how to automatically expand container horizontally depending on how many elements are in it. My scenario:

  • I have one main container that will be scrollable
  • Within the main container, I have Sub containers (sections)
  • Each Sub container contains different elements stacked on top of each other vertically.

Requirements:

I want to auto adjust sub containers depending on how many buttons there are on top of each other for ex. My idea was, that I would do "ForAll" function on all child elements of "Sub1", there I would get reference to every button, get its height, and add everything together. so if one button has height of 30px, multiply it by 4, that is 120px and that would the be the height of the container. The moment, one button is hidden dynamically, height of the container would be 30x3 = 90px

 

Problem is, I have no idea, how to get child elements of a parent. I wanted to do something like:
Screen4.Main.Sub1.Items

 

I cannot use other lists/collections where I would be storing elements of each section, because that will be a nightmare to handle. I will be storing different sections with different heights. 😞 Please, do you have any other idea, how to get list of children elements dynamically?

 

img2.png

  • PeterFridrich Profile Picture
    PeterFridrich 11 on at
    Re: How to create auto height for containers

    that's unfortunate. I wish MS would provide us a way how to get elements within an app starting from screens down to all other elements. thank you

  • PowerAddict Profile Picture
    PowerAddict 7,314 on at
    Re: How to create auto height for containers

    @PeterFridrich there probably isn't a way to do that. You would have to write the expressions factoring in each sub-container and using their Visible property to conditionally define the height. 

     

    ---
    If you like this reply, please give kudos (Thumbs Up). And if this solves your problem, please mark this reply as a solution by selecting Accept as Solution. This makes it easier for others to find answers to similar questions. 

     

    Thanks!

    Hardit Bhatia

    Microsoft Business Applications MVP

    Microsoft Certified Trainer MCT

    Blog | Twitter | LinkedIn | Facebook | YouTube  |  Email

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

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,508

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,839

Leaderboard