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 / Change individual row ...
Power Apps
Answered

Change individual row fill colors in a gallery based on a button in that row

(0) ShareShare
ReportReport
Posted on by 674

I have a gallery with rows connected to a data source. I would like to change the template fill color of an individual row to green when a button in that row is pressed or the item is selected. I have been able to do this, but it will only change one row at a time to green, and the others remain the default blue color.  Once a row has been selected and turns green, I want it to stay green regardless of selecting another row. Any ideas on this? My code so far:

TemplateFill property for the gallery:  

If (ThisItem.IsSelected, RGBA(67, 245, 39, .8),
If(!ThisItem.IsSelected, RGBA(39, 174, 245, .8), RGBA(67, 245, 39, .8)
   )
)

 

I also have a button that does some other actions (in each row), so could add actions to the OnSelect property of the button as needed.

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

    Hi @Runner55552,

     

    You can achieve this by making the OnSelect of the gallery and/or the OnSelect of your button save a unique field of that item to a collection. In the example below, I am saving the ID field:

     

    Collect(colSelectedItems, ThisItem.ID)

     

    The Fill property of your items (TemplateFill) should be:

    If(
     ThisItem.ID in colSelectedItems,
     RGBA(67, 245, 39, .8),
     RGBA(39, 174, 245, .8)
    )

     

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

    Thanks!

  • TheRobRush Profile Picture
    11,128 Moderator on at

    One Example

     

    Set your template fill to

    If(ThisItem in testRange, RGBA(0, 89, 178, 1), RGBA(0, 89, 178, 0)) 

    adjust colors as needed mine are just to test it out

     

    then onselect of each item should be

    If(ThisItem in testRange, Remove(testRange, ThisItem), Collect(testRange, ThisItem))
     
  • TheRobRush Profile Picture
    11,128 Moderator on at

    sorry @LaurensM we crossed >.<

  • LaurensM Profile Picture
    12,516 Moderator on at

    @TheRobRushno worries!

    I stand behind 'the more the merrier' 😉

  • 55552 Profile Picture
    674 on at

    This worked!  The only addition in my case was that I have a dropdown control that a user selects a value, then the gallery is filtered by the dropdown answer. So I added Clear(CollectionName) here so that each time a new selection is made, the Collection is cleared.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 545 Most Valuable Professional

#2
Haque Profile Picture

Haque 314

#3
Kalathiya Profile Picture

Kalathiya 234 Super User 2026 Season 1

Last 30 days Overall leaderboard