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?
Thanks. This worked the best for what I was trying to do.
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!
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.