cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
bouillons
Helper V
Helper V

How to dynamically adjust the height of a form to fit the contents

Hi, I have a scenario where I want to dynamically grow/shrink a form to show all the content. I think flexible height should do this, but I haven't figured out how. I want the form to be exactly as high as needed to display all the content, taking into account that when the screen is resized or rotated, the controls might wrap, and thus make the total height higher or shorter. I don't want to use scrollbars. The form is in a vertical container, and I don't want there to be gap with the other content lower in the container.

 

Stephane

4 REPLIES 4
v-jefferni
Community Support
Community Support

Hi @bouillons ,

 

Since the Form is in a vertical container, the Height of the Form would be fix to the Height of the Container. So if you would like to make the Form's height exactly as high as all contents in the Form, you will need to set the flexible height in Height of the Container. For instance:

'DataCard1'.Height+'DataCard2'.Height+'DataCard3'.Height+...+'DataCardX'.Height

 

Hope this helps.

 

Best regards,

Community Support Team _ Jeffer Ni
If this post helps, then please consider Accept it as the solution to help the other members find it.

Community Support Team _ Jeffer Ni

If this post helps, then please consider Accept it as the solution to help the other members find it.

bouillons
Helper V
Helper V

I cannot simply total the height of all the datacards, because I have to take into account that datacards can be  wrapped. I mean, depending on the width of the screen after resizing, the form may show 4, 3, 2,or 1 columns. I want the form to simply stretch or shrink to the minimum total size necessary to display everything.

igord93
Regular Visitor

Any tips on how to do this? I am having the same issue and I cannot find a proper way to tackle that. Whenever I stretch the screen there is the height of the form that I cannot figure out how to solve.

Parteli
Frequent Visitor

Hello all,

I can see that this is a somewhat old post, but can't find a newer or solved one for this problem...

I've been trying something similar and didn't found a "perfect" solution yet. But if you create an empty and invisible DataCard and set its Y property (on the advanced panel) to like 10000 so it is always the last card and then set the Form.Height to the DataCard.Y , the form wil resize everytime something changes.
This worked well for me in some forms. Even when I place a growing gallery in the middle of the form. The card of the gallery would get bigger and the form would resize right after.

Unfortunately, this will break when the visibility of 1 card changes. The form does not resize when you make a card appear or desapear... This also does not work with variables on the Form.Height, it needs to be a direct reference to the last DataCard.Y .


I don't know how this trick will behave when the screen rotates. But I guess it will work if the you let the PowerApps handle the placement of the cards.

Lately I'm been trying to make sections that can be expanded or hidden, but I have fail to create a setup that works. Any suggestions?

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (4,600)