cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Marie_Causse
Regular Visitor

Differente color dropdown DataCardValue (List Sharepoint)

Hello everyone, 

 

I'm writing to you because I'm stuck on a manipulation that I think is actually simple to perform.
I created a list on sharepoint that I put on powerapps as Forms. In this list is a drop-down menu in which I have the values "TB", "B", "M", "I", "TI" (which means very good, good, average, insufficient, really insufficient, in French).

 

My goal is to display these values with different colors in the dropdown menu ("TB" in green for example and "TI" in red).

 

I already managed to display the final value with its color in SelectedTagFill with this code (you can find the result in attachment Screenshot 1):

If(

  DataCardValue25.Selected.Value = "TB", Color.MediumSeaGreen,

  DataCardValue25.Selected.Value = "B", Color.DarkTurquoise,

      DataCardValue25.Selected.Value = "M", Color.Gray,

      DataCardValue25.Selected.Value = "I", Color.Gold,

      DataCardValue25.Selected.Value = "TI", Color.Tomato

      )

 

The color is also correct in the SelectionFill (screenshot 2). 

But all the boxes are white and I can't assign the right color to them, I would like each choice to have a different color when I unroll the menu.

I have the same problem with my HoverFill (I put the same code than for my SelectedTagFill) which when I move my mouse over the values has the color of the selected value and not a different color each time (Screenshot 3).

 

I tried with "DataCardValue25.Value" instead of "DataCardValue25.Selected.Value" but I have an error. 

 

Please to you have a tips for me ? 

 

(I tried to make 

If(
DataCardValue25.Selected.Value = "TB", Color.MediumSeaGreen,If(
DataCardValue25.Selected.Value = "B", Color.DarkTurquoise, If(
DataCardValue25.Selected.Value = "M", Color.Gray, If(
DataCardValue25.Selected.Value = "I", Color.Gold, If(
DataCardValue25.Selected.Value = "TI", Color.Tomato
)))))

But I have the same result).

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @Marie_Causse ,

Yes that is correct - there is no way of having different colours in each item of a drop-down.

 

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.

View solution in original post

5 REPLIES 5
WarrenBelz
Super User III
Super User III

Hi @Marie_Causse ,
Use this

Switch(
   Self.Selected.Value,
   "TB", Color.MediumSeaGreen,
   "B", Color.DarkTurquoise,
   "M", Color.Gray,
   "I", Color.Gold,
   "TI", Color.Tomato
)

on the SelectionFill and then the Color is simply

Self.SelectionFill

Your HoverFill will be dependant on what is selected (it does not know what it is hovering over), but you can use the same syntax on it.

 

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.

Thank you, your way to write it is so much cleaner et easier, I am going to use it ! But this does not change the result...

I always have the color that corresponds to the color of the selected text and not a different color or one that changes depending on the text.

proxyprochy
Resolver I
Resolver I

Looks like it doesn't change the color when the selection is changed. The solution could be:

 

DataCardValue25.HoverFill = selectedTextColor

 

DataCardValue25.OnChange =
Switch(
Self.Selected.Value,
"TB",
UpdateContext({selectedTextColor: Red}),
"B",
UpdateContext({selectedTextColor: Blue})
)

Hi @Marie_Causse ,

Yes that is correct - there is no way of having different colours in each item of a drop-down.

 

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.

View solution in original post

Ok, thank you for your help. Have a good day !

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

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

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.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Users online (1,326)