cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Magnifica
Helper I
Helper I

Gallery background color set according to value of field in the SP List

Hi everone,

 

I want to change the the background color of a card in the gallery according to the value of a field from the SP List. 

This field is not displayed in the gallery. Is it possible to change the color by a field value? If so, how do i achieve that?

 

I hope someone can Help. Thanks in advance. 

2 REPLIES 2
mr-dang
Community Champion
Community Champion

Hi, this is possible. I am just uncertain what you mean by 'card'--are you using a regular gallery or a form?

 

For regular galleries, if you want the background color to change, you will set a condition in the TemplateFill property of the Gallery. Don't confuse it with the Fill property which is the backgound of the Gallery overall. Example:

 

If(Column1>40,
	RGBA(62, 96, 170, 1),
	RGBA(0, 0, 0, 0)
)

This means that if Column1 of the datasource is greater than 40, then it will apply the given color, otherwise it will be transparent. Set the condition(s) as needed. The column does not need to be visible in any controls for this to work.

 

To change the background of an individual card in a detail form, you will select a card in the detail form and set a condition in the Fill property of the card. This time, you will need to use ThisItem in your condition so that PowerApps knows you want the respective values.

If(ThisItem.Column1>40,
	RGBA(62, 96, 170, 1),
	RGBA(0, 0, 0, 0)
)

 

The condition can reference any field even if it is not in the card.

Microsoft Employee
@8bitclassroom

I mean an Item in a Gallery.

Its an Event with a Date. If the Date is in 2 Weeks the item should have another color then the others.

 

I cant find a TemplateFill property of the Gallery. there is a TemplateSize and TemplatePadding but not no Templatefill...

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Carousel April Dunnam Updated 768x460.jpg

Urdu Hindi D365 Bootcamp

Dont miss our very own April Dunnam’s The Developer Guide to the Galaxy! Find out what the Power Platform has to offer for the traditional developer.

Top Solution Authors
Top Kudoed Authors
Users online (2,010)