cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Anonymous
Not applicable

Dropdown color change

Hi,

 

I want to change the color of the item when it is selected on the dropdown. 

 

If it can be done with simple drop down, please suggest. If it has to be done by gallery please suggest all the steps in details.

 

Attachment is to provide exact scenario. 'Ontrack': Green . 'Off-Track' has to be made Red in color.

 

Regards,

Nandan

 

@WarrenBelz @GarethPrisk 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted

@Anonymous 
I was able to re-create your situation and it works for me :).  Here's you can replicate what I did.

Put this code in the Items property of the dropdown.

Table({Status: "OnTrack"}, {Status: "OffTrack"}).Status

 

Put this code in the Fill property of the dropdown.

Switch(
    Dropdown1.Selected.Status,
    "OnTrack", Green,
    "OffTrack", Red
)

 

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

View solution in original post

15 REPLIES 15
Highlighted
Super User III
Super User III

@Anonymous 
Use this code in the Fill property of your dropdown

 

Switch(
    Dropdown1.Selected.Value,
    "On-Track", Green,
    "Off-Track", Red
)

 

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up." 

Highlighted
Anonymous
Not applicable

Thank You @MD But the provided code wont work. 😞 

 

Highlighted

@Anonymous 
Please give a little more detail: what do you mean by "it won't work?"  Did you receive any error message?

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

Highlighted
Anonymous
Not applicable

@mdevaneyThank you for your response.  I apologize, I would have provided the error message. Screenshot attached. 

Highlighted

@Anonymous 

Your column must be named something different than "Value".  Type this code section of code and see what comes up in the AutoComplete.  Then choose the appropriate column

 

Dropdown1.Selected.


---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

Highlighted
Anonymous
Not applicable

Thank you @mdevaney … There is no error message. But it wont work for the Red. Seems it is not getting through to the next line: "Off-Track, Red . I have altered the color to check, the first line : "On-Track", Green, is working but not the second part. 😞

Highlighted

@Anonymous 

This section of code is missing a closing quote

 

"Off-Track", Red

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

Highlighted
Anonymous
Not applicable

Apology for my typo, I have provided proper opening and closing quotes. But the result is the same. Its working for the first part while for the second part it is not.

Anyway, I am grateful for your support till now. 

Highlighted

@Anonymous 

Can you please share a screenshot of the code you wrote in the formula bar?  I am not seeing the reason for the error...

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (12,723)