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 / Using galleries for bu...
Power Apps
Unanswered

Using galleries for buttons that correspond to second gallery items

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hello,

I am new to PowerApps, but have been able to create an app that has two galleries connected to two SharePoint lists - one that is a list of three buttons - low, medium and high - and the second gallery which displays a list of resources. The list of resources is categorized by the complexity level. Therefore, when you click the "Low" button, only resources that are categorized as "Low" will appear. However, when you click the "Medium" button, resources for both "Low" and "Medium" will appear. Thus, the "High" view shows all resources for each level.


I want to have each button turn a different color when clicked, and then for the background of the resources rows that correspond to that button categorization also change to that color. (For example, when you click on "Low" the button will turn pink, and the background of all corresponding items in the resources gallery will also turn pink.) However, this means that I would want the "High" button to display three different colors to represent the level of complexity that each button represents. (i.e., Low = pink, Medium = green, High = red and clicking on the "High" button would show all these colors.)

 

Is this even possible? I've included a screenshot below of the current view of my app for reference:

kristenlee0306_0-1603387106147.png

Thank you!

Categories:
  • PowerRanger Profile Picture
    3,458 Super User 2024 Season 1 on at

    Hi @Anonymous ,

     

    first of all you need to set a variable to identify which Button was clicked. So on each Button OnSelect Property you need to apply a Set function:

     

     

    Button Low OnSelect Property:
    Set(selectedCompexity,["Low"])
    
    Button Medium OnSelect Property:
    Set(selectedCompexity,["Medium","Low"])
    
    Button High OnSelect Property:
    Set(selectedCompexity,["high","Medium","Low"])

     

     

    In addition you need to set the Fill Property of each Button:

     

    Button Low Fill Property:
    If("Low" in selectedCompexity,Pink,RGBA(56, 96, 178, 1))
    
    Button Medium Fill Property:
    If("Medium" in selectedCompexity,Green,RGBA(56, 96, 178, 1))
    
    Button High Fill Property:
    If("High" in selectedCompexity,Red,RGBA(56, 96, 178, 1))

     

     

    Last you need to to set the TemplateFill Property of the Gallery Contol. In my Case I have a field called complexity in my datasource:

     

     

    Switch(
     ThisItem.Complexity,
     "Low",
     Pink,
     "Medium",
     Green,
     "High",
     Red
    )

     

     

    Thats it. Please try and let me know if this meets your requirement.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    I'm sorry to be dense, but how do I set the "OnSelect" properties of each button when they are located in a gallery? I know how to set that for the Low button, but how do I set it for the medium and high options?

     

    I really am trying to learn this new application so I do apologize for the dumb question.

  • PowerRanger Profile Picture
    3,458 Super User 2024 Season 1 on at

    Hi @Anonymous 

     

    Is there a special reason why you use a gallery to show the buttons? Why do you not just place them on the screen?

     

  • PowerRanger Profile Picture
    3,458 Super User 2024 Season 1 on at

    @Anonymous 

     

    If there is a good reason to have a Gallery to show the button you need to put the formulas in a switch statement.

     

    switch(ThisItem.buttonComplexity,"Low",<code for low>,"Medium",<code for medium>,"High",<code for high>)

     

    This applies for OnSelect as well as Fill

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

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
11manish Profile Picture

11manish 395 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 328

#3
WarrenBelz Profile Picture

WarrenBelz 260 Most Valuable Professional

Last 30 days Overall leaderboard