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 button colour a...
Power Apps
Answered

Change button colour and text based on condition

(0) ShareShare
ReportReport
Posted on by 266

Hello everyone,

Goal: 1 screen button colour and text changes when button is pressed on 2nd screen.

My solution: by passing variable parameter through navigate.

 

2nd screen button formula: 

Navigate(Home,ScreenTransition.Cover,{Label: DataCardValue21.Text, Shade:Color.Green});

 

1screen button fill formula: 

If(Shade=Green,Green,RGBA(164, 38, 44, 1))

 

Problem: I want only one entry of FM to change, but all the entries change colour. (I also pass ID from the 2nd scree)

I am not sure, what I am doing wrong.

p_doc_0-1643685284589.png

 

Any help is appreciated.

Categories:
  • Verified answer
    WarrenBelz Profile Picture
    156,940 Most Valuable Professional on at

    Hi @PaulMatha ,

    I assume the code in the bottom gallery is the one you want changed and only green on the one selected?

    If(
     ThisItem.IsSelected,
     Shade,
     RGBA(164, 38, 44, 1)
    )

     

    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.

    Visit my blog Practical Power Apps

  • Paul_M Profile Picture
    266 on at

    Hi @WarrenBelz ,

    Thank you for your reply.

    That is exactly what I wanted.

    But now it keeps on changing colour, I want to keep he colour same after changing.

    image 1:

    p_doc_0-1643704832041.png

     

    image 2: 

    p_doc_1-1643704849337.png

     

  • WarrenBelz Profile Picture
    156,940 Most Valuable Professional on at

    Hi @PaulMatha ,

    You need this one way or the other unless you want to get really complex here - the IsSelected property will allow identification of the current selected record, or leaving it out will colour all icons the gallery.

     

    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.

    Visit my blog Practical Power Apps

  • Paul_M Profile Picture
    266 on at

    Hi @WarrenBelz ,

     

    Can you please help me with this.

    I have this formula : 

    If( ThisItem.IsSelected And DataCardValue16.Selected.Value = 'Complete option'.Complete ,DisplayMode.Disabled, DisplayMode.Edit)

     

    but as soon as I select something else, the button becomes enabled. (I know I have AND condition)

    How can I use IsSelected function on other screen button.

    Should I add a Variable, but variable will have impact on other buttons as well.

     

     

    If( DataCardValue16.Selected.Value = 'Complete option'.Complete ,DisplayMode.Disabled, DisplayMode.Edit)

    all the button gets disabled.

     

    p_doc_0-1645146318445.png

     

    Any help or guidance is apperciated.

     

  • WarrenBelz Profile Picture
    156,940 Most Valuable Professional on at

    Hi @PaulMatha ,

    The only way I can think of is to Patch the contents of the drop-down to the list or collection the gallery is based on as soon as you change it. That way you can base the condition on ThisItem.FieldName, which will be updated.

     

    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.

    Visit my blog Practical Power Apps

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

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 236 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 188 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 130

Last 30 days Overall leaderboard