cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Englishweb
Post Patron
Post Patron

change text colour on Button in Gallery using If

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!

 

1 ACCEPTED SOLUTION

Accepted Solutions

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

View solution in original post

5 REPLIES 5
Jcook
Super User
Super User

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


Did I answer your question? Mark my post as a solution!

If you like my post please hit the Thumbs Up


Proud to be a Flownaut!


Check out my blog for Power Automate tips,
tricks, and guides
FlowAltDelete





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.

What are the relationship between the 2 galleries. Could you share some more info or pictures?

Did I answer your question? Mark my post as a solution!

If you like my post please hit the Thumbs Up


Proud to be a Flownaut!


Check out my blog for Power Automate tips,
tricks, and guides
FlowAltDelete





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

Does this help?

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

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

May UG Leader Call Carousel 768x460.png

June User Group Leader Call

Join us on June 28 for our monthly User Group leader call!

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Users online (1,182)