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 / Changing a property wi...
Power Apps
Unanswered

Changing a property with a button

(1) ShareShare
ReportReport
Posted on by 2,129

Content migrated from TechNet.  Post attribution to: Benjamin Niaulin

 

I put a label on the app and decided to get familiar with PowerApps by doing some basic things. Mind you I am not a developer but did ask fellow Devs before coming here with no luck.

 

After putting a label on the screen, I then selected its "Fill" property and wrote the following formula.

 

If(Checkbox1!Value = true, RGBA(244, 115, 33, 1), RGBA(0, 0, 0, 0 ))

 

This works great.

Now, if I put a button on the screen and replace Checkbox1!Value to Button1!Pressed it does not work. Why? I want to be able to have users press buttons and things to change, is this not the expected behaviour?

 

Also, how can I change the button to use one of my images instead?

 

Thanks for your time.


Benjamin Niaulin Blog: http://bniaulin.wordpress.com

Twitter: @bniaulin

Categories:
I have the same question (0)
  • Migrated_User Profile Picture
    2,129 on at

    Hi

    Add a button, say the name remains as Button1. It Works for me.

     

    If(Button1!Pressed, RGBA(244, 115, 33, 1), RGBA(0, 0, 0, 0 )).

     

    Remember, you don't have to be Button1!Pressed = true. Your "Click or Press" action tells it "It is true when Pressed and False when released")

     


    PK Hong

     

  • Migrated_User Profile Picture
    2,129 on at

    Does not work for me and a friend who also has access to the preview tried it and does not work for him either.

    Do you have anything different? I'm on 2.0.320 

     

     

     

     


    Benjamin Niaulin Blog: <a href="http://en.share-gate.com/blog">http://en.share-gate.com/blog</a></p> <p>Twitter: <a href="http://twitter.com/bniaulin">@bniaulin</a></p>

  • Migrated_User Profile Picture
    2,129 on at

    HI

    Apologize for that. As I was offline just now, I used Project Siena to confirm and it really worked.

    I tried again on PoweApps now and yup, you are right, nothing changed!

    Wish someone else can figure out why PowerApps can't.

    Anyway, temporarily I advise to use Pressed Fill and Press Color (as in image) to change color when someone click on the Button with contents or even Label with contents. both work.


    PK Hong

  • Verified answer
    Migrated_User Profile Picture
    2,129 on at

    Try this on 2.0.340 (released last night):

    1. On the Content tab, select Media, and then select Image.

     

    2. Near the upper-right corner, select Browse, select the image that you want to use, and then selectOpen.

     

    3. Press Esc to return to the default workspace.

     

    4. Add an image control, set its Image property to the file that you just added, and set its OnSelectproperty to this formula:

    If(BoxColor = "orange", UpdateContext({BoxColor:"white"}), UpdateContext({BoxColor:"orange"}))

     

    5. Add a text box, and then set its Fill property to this formula:

    If(BoxColor="white", RGBA(0,0,0,0), RGBA(244, 115, 33, 1))

  • Migrated_User Profile Picture
    2,129 on at

    Going to try it, but not sure I understand where the BoxColor property comes from?

     

    Getting used to PowerApps and it's weird it works by doing a lot of If and a lot of update context to set variables and then using them.

     

    I was expecting something a little more straight forward, I got a button and I want text.nameofproperty to change to x when I press it.

     

    In any case will check it out and it helps me not use a button, seems to be like the Button is not meant to be used except for navigate to another screen or patch my datasource.


    Benjamin Niaulin Blog: http://en.share-gate.com/blog Twitter: http://twitter.com/bniaulin

  • Migrated_User Profile Picture
    2,129 on at

    You can absolutely use a button instead of an image. I suggested the image only because you said: "Also, how can I change the button to use one of my images instead?"

     

    To use a button, skip the first three steps, and change step 4 to:

     

    4. Add a button, and set its OnSelect property to...

     

    You use a context variable (which I named BoxColor, but you can specify your own name) because, for example, you can change the fill from white to orange when a user selects the button, but what should happen if the user selects the button again? Should the fill stay orange?

     

    Does this topic help?

  • Migrated_User Profile Picture
    2,129 on at

    Thanks for your help makes a lot of sense!

     


    Benjamin Niaulin Blog: http://en.share-gate.com/blog Twitter: http://twitter.com/bniaulin

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

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard