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 / Trying to do ANYTHING ...
Power Apps
Unanswered

Trying to do ANYTHING on click of an image

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

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?

Categories:
I have the same question (0)
  • Verified answer
    Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    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.

  • CarlosFigueira Profile Picture
    on at

    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
    BR-30101711-0 Profile Picture
    Microsoft Employee on at

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

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 759 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 310 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 228

Last 30 days Overall leaderboard