Skip to main content

Notifications

Power Apps - Building Power Apps
Answered

Trying to do ANYTHING on click of an image

(0) ShareShare
ReportReport
Posted on by

A newbie here (1st time with Power Apps). I am trying to either hide a label or change it's color when an image is clicked. You know, basic stuff. 

 

Using the attached image for reference --

For the image named "btn", I have tried using the OnSelect with:

btn.Visible=false

and 

Label2.Color = Red

However, nothing changes when I run it.

Ideas?

  • Verified answer
    Re: Trying to do ANYTHING on click of an image

    Thanks. This worked the best for what I was trying to do.

  • Re: Trying to do ANYTHING on click of an image

    Welcome to the Power Apps platform :). To do what you want, you can use a variable that would be bound to the visibility (or the color), and change that in the OnSelect property of your image.

    For example, if you set the initial values in the App.OnStart property:

    Set(buttonVisibility, true);
    Set(labelColor, Color.White)

    And set the Visible property of the button to 'buttonVisibility' and the Color property of the label to 'labelColor', you can change the visibility and color with this expression in the OnSelect property of your image:

    Set(buttonVisibility, false);
    Set(labelColor, Color.Red)

     Hope this helps!

  • Verified answer
    Drrickryp Profile Picture
    Drrickryp on at
    Re: Trying to do ANYTHING on click of an image

    Hi @Keltanis 

    Use a context variable to make your changes. In the OnSelect property of the image: UpdateContext({var:false, clr:Red}) and set the Visible property of the control to var and the color property of label2 as clr. In the OnVisible property of the screen containing the controls use UpdateContext({var:true, clr:green})  as an example of setting the default property of the image and the label.

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,580

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,909

Leaderboard