cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
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
Highlighted
Post Patron
Post Patron

Re: change text colour on Button in Gallery using If

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
Highlighted
Super User III
Super User III

Re: change text colour on Button in Gallery using If

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!





Highlighted
Post Patron
Post Patron

Re: change text colour on Button in Gallery using If

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.

Highlighted
Super User III
Super User III

Re: change text colour on Button in Gallery using If

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!





Highlighted
Post Patron
Post Patron

Re: change text colour on Button in Gallery using If

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

Does this help?

Highlighted
Post Patron
Post Patron

Re: change text colour on Button in Gallery using If

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

Helpful resources

Announcements
secondImage

Demo-Extravaganza 2020

Check out these cool Power Apps & vote on your favorite!

secondImage

Community Highlights

Check out whats happening in Power Apps

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (14,495)