web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Setting a variable to ...
Power Apps
Answered

Setting a variable to adjust the height of a container

(1) ShareShare
ReportReport
Posted on by 196
Hello, 
 
I'm trying to set a variable in the onSelect of an Icon to toggle the height of a container to a specific height after the initial click, then back to parent.height upon the second click.  This seems pretty simple, though I can't for the life of me figure out the formula, which is probably right in front of my face.  
Categories:
I have the same question (0)
  • Verified answer
    Pstork1 Profile Picture
    68,717 Most Valuable Professional on at
    I suspect you are trying to set the variable to the specific height you want and that probably isn't the best way to do it.  Lets say you want the container to be 900 pixels high when you click the icon and then revert to parent. height when you click it again.  For that use the following two formulas.
     
    //For the OnSelect of the Icon
    
    Set(varToggle, !varToggle);
    
    
    //For the Height of the container
    
    if(varToggle, 900, Parent.Height)
  • Suggested answer
    DerrickH Profile Picture
    196 on at
    It's probably not the best way to do it, but I figured out one way for it to work.  I set a context variable to (true) in the onvisible property of the screen, then the same variable to UpdateContext({locConHeight:!locConHeight}), then added an IF statement to the height property of the container - If(locConHeight, 50, parent.height)

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 739 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard