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 text colour on ...
Power Apps
Answered

change text colour on Button in Gallery using If

(0) ShareShare
ReportReport
Posted on by 371

Hello

I'm trying to figure out the syntax to change a button text colour in a gallery item in the color properties using:

If(ThisItem),(DatePickerS1End.SelectedDate <=Today(),Red,Green)

The text property is ThisItem.Student1

I don't know how/where to reference ThisItem

Can anyone help?

Thanks!

 

Categories:
I have the same question (0)
  • Jcook Profile Picture
    7,783 Most Valuable Professional on at

    Hello @Englishweb

    Let me understand this a bit more, so you wan to have al the buttons in your gallery text red if the date that is selected in the date picker is Today, or some date in the past. But if the Date is tomorrow or farther than text is green?

     

    Here is what I came up with:

     

    PicMain.png

     

    The Syntax I am using on the button Color = If(DatePicker2.SelectedDate <= Today(), Red,Green)

     

    You do not need to use ThisItem to make this work.

     

    Hope this helped!

     

    --Josh

  • Englishweb Profile Picture
    371 on at

    Hello @Jcook That's exactly what I was aiming for, unfortunately, all the buttons on the Parent Gallery turn red! The date picker is on the child gallery (where the same syntax works perfectly). Its the parent gallery button text colour which is the problem.

  • Jcook Profile Picture
    7,783 Most Valuable Professional on at
    What are the relationship between the 2 galleries. Could you share some more info or pictures?
  • Englishweb Profile Picture
    371 on at

    hello @Jcook The parent gallery ireferences the datasource and the child gallery is ParentGallery.Selected

    Does this help?

  • Verified answer
    Englishweb Profile Picture
    371 on at

    There are other buttons on the Parent gallery which are working as expected:If(Value(S1Hrs)>=10,Red,White)

    I'm trying to get each button text to change colour , using the item

     = If(DatePicker1.SelectedDate (Student1)<= Today(), Red,Green)

    At the moment each button changes to the same colour, according to the gallery row selected

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

#2
11manish Profile Picture

11manish 141 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 109 Super User 2026 Season 2

Last 30 days Overall leaderboard