I have had some success with setting form heights dynamically by using IF statements. An example would be:
In this scenario, there is a toggle, that when switched to "Yes" displays the form panel, and when switched to "No" hides the form panel, as the height is changed to 0. There are some scenarios where certain data cards are removed from visibility. For these, I change the visibility of the objects inside the card to 0, and I change the height of the data card to 0, and the form resizes itself as expected. For the most part.
Sometimes these forms don't always expand and contract perfectly, at least while working in the editor, and scroll bars become visible. But generally this method works mostly ok in playback mode or when published and played in the browser. Not 100%, but kinda works.
I needed to hide some data cards with buttons, so I used a context variable. This works. But now the form in question no longer contracts to a shorter length when the fields are hidden using the variable. So the dynamic form resizing works with the IF statements, but doesn't work with the context variable. Please see screenshots. And thanks!
I assume you are setting the visible property of the Card, not the controls. In general, we don't need to adjust the height of the control. Only change the visible property of the card.
And also you have to use a Scrollable screen
We have a similar scenario with one of our current projects and the above works charmly. We have very complex logic to enable control.
Stalin - Learn To Illuminate
We are conditionally setting the visibility of the objects inside the card (StarVisible, DataCardKey, ErrorMessage, DataCardValue) and conditionally setting the height of the card itself, in order to make the cards "disappear" conditionally. And yep, using a scrollable screen.
Join us for the next call on August 17, 2022 at 8am PDT.
The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.