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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Button colour changes ...
Power Apps
Answered

Button colour changes for all gallery selected items in edit screen.

(0) ShareShare
ReportReport
Posted on by 15

Hi All,

 

I have to a data card in my edit screen to push calendar appointments to outlook, which works as intended. I would like to change the colour of the button once it is selected. I have set the onselect value to UpdateContext({OneClicked:true}); and the fill value to 

If(
OneClicked,
DarkGreen,
DarkBlue
).

 

This works, however the buttons colour has now changed in the edit screen of every gallery item selected instead of just the one selected.

Any help would be appreciated.

Categories:
I have the same question (0)
  • LaurensM Profile Picture
    12,516 Moderator on at

    Hi @Gerardk333,

     

    You can actually achieve this without the need of a variable. The native button property 'PressedFill' changes the fill of that particular button when it is pressed / selected.

     

    You can leave the Fill property DarkBlue and add DarkGreen to the PressedFill property.

     

    If you want to keep the Fill DarkGreen after the press, your approach will be the correct way to go but will need a bit of tweaking in order to only change that particular button.

     

    Since the button is in the gallery we can actually save a field that is unique to each row of the gallery. In my example below I am using the ID field but, you can adjust this to whatever field is unique in your case.

     

    OnSelect of the button:

    //Save the current selected record in a variable
    UpdateContext({varRecord: ThisItem})

     

    Fill property of the button:

    //Change ID to a unique field within your datasource
    If(ThisItem.ID = varRecord.ID, DarkGreen, DarkBlue)

     

    If this answers your question, would you be so kind as to accept it as a solution.

    Thanks!

  • Gerardk333 Profile Picture
    15 on at

    Hi LaurensM,

    Thankyou for your response, but having re-read my post I see that I did not make my issue clear, so I'll make another attempt. The button I refer to is one that was inserted into a toggle datacard within the edit screen. The toggle is selected to make the button visible only if a particular job type is true. A date, time and address values are completed in the editscreen and the button is selected to create an appointment in my outlook calendar.

    The logic behind the colour change of the button was merely as a confirmation that it had been selected and the information pushed through to outlook. I thought that this would have been an easier option than messing around with outlook for some form of confirmation. The issue is that I have the colour change working, but it changes the button in the edit screen of all my selected gallery items. 

     

    button.jpg
  • Verified answer
    Gerardk333 Profile Picture
    15 on at

    Just a bit of an update, I've managed to get this working in a convoluted way, but it does work well.

    First, I started by inserting a button and made it dark blue.

    Second, in inserted a toggle over the button.

    Third, I inserted a text label over the toggle and used an If statement to toggle between "Send to outlook" & "Sent to outlook"

    Fourth, in the "onselect" of the toggle I added my code to push the appointment details to outlook

    Fifth, make all the the toggle properties transparent and set the order to "bring to front".

     

    Though I didn't achieve the colour change I was after, I think I can do it with an if statement similarly to the text change. However I'm not that concerned as I now have an indication of the information being sent to outlook via the change in text. Thankyou for your input.

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 429 Most Valuable Professional

#2
11manish Profile Picture

11manish 191 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 122 Super User 2026 Season 2

Last 30 days Overall leaderboard