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

Change color of shape based on radio button

I have a radio button with three choices and this is the code for the fill on a shape If(Radio1.Selected.Value = "Works", RGBA(0,255,0,.5), Radio1.Selected.Value = "Has issues", RGBA(255,255,0,.5), Radio1.Selected.Value = "Does not work", RGBA(255,0,0,.6)). The shape defaults to black how can I make it default to white? Also for some reason the first time I click the radio button it will default the rest of the shapes to that color. But the other shapes should stay blank until the radio button is selected. 

1 ACCEPTED SOLUTION

Accepted Solutions
Skilled Sharer
Skilled Sharer

@powerapps890 Follow below steps:

  1. Create a collection for Radio button choices as:

 

ClearCollect(RadioItems, "Works","Has issues","Does not work")

 

  • Add radio button and set it's Items property to RadioItems.Value.
  • Add a shape (Ex. circle) and select set its Fill property to:

 

If(IsBlankOrError(Radio1.Selected.Value), Color.White, Radio1.Selected.Value = "Works", RGBA(0,255,0,.5), Radio1.Selected.Value = "Has issues", RGBA(255,255,0,.5), Radio1.Selected.Value = "Does not work", RGBA(255,0,0,.6))

 


Please click Accept as solution if my post helped you solve your issue. This will help others find the correct solution easily. It also closes the item. If the content was useful in other ways, please consider giving it 👍

 

View solution in original post

7 REPLIES 7
Super User III
Super User III

Try

If(Radio1.Selected.Value = "",White,

Radio1.Selected.Value = "Works", RGBA(0,255,0,.5), Radio1.Selected.Value = "Has issues", RGBA(255,255,0,.5), Radio1.Selected.Value = "Does not work", RGBA(255,0,0,.6))

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

The shape is still black, it didn't work. @eka24 

Skilled Sharer
Skilled Sharer

@powerapps890 Follow below steps:

  1. Create a collection for Radio button choices as:

 

ClearCollect(RadioItems, "Works","Has issues","Does not work")

 

  • Add radio button and set it's Items property to RadioItems.Value.
  • Add a shape (Ex. circle) and select set its Fill property to:

 

If(IsBlankOrError(Radio1.Selected.Value), Color.White, Radio1.Selected.Value = "Works", RGBA(0,255,0,.5), Radio1.Selected.Value = "Has issues", RGBA(255,255,0,.5), Radio1.Selected.Value = "Does not work", RGBA(255,0,0,.6))

 


Please click Accept as solution if my post helped you solve your issue. This will help others find the correct solution easily. It also closes the item. If the content was useful in other ways, please consider giving it 👍

 

View solution in original post

This works, but there is an issue. If I choose works it will make the first one green and then the next few are still white, but the remaining are green. Why are the rest turning green when they haven't even been selected? @ganeshsanap 

What if you try this:
If(IsBlankOrError(Radio1.Selected.Value), Color.White, Radio1.Selected.Value = "Works", RGBA(0,255,0,.5), Radio1.Selected.Value = "Has issues", RGBA(255,255,0,.5), Radio1.Selected.Value = "Does not work", RGBA(255,0,0,.6), Color.White)

@powerapps890 Are you using the same formula and same Radio button for all the shapes? If the radio buttons are different for some shapes then make sure you are referencing to correct radio button in the formula.


Please click Accept as solution if my post helped you solve your issue. This will help others find the correct solution easily. It also closes the item. If the content was useful in other ways, please consider giving it 👍

 

Yes, it is all in the gallery so there is only one kind of shape and radio button repeated for each item. For some reason when filtering, it will automatically make the color of the first selected button the rest of unselected radio items. @ganeshsanap 

Helpful resources

Announcements
News & Announcements

Community Blog

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

Power Apps Community Call

Power Apps Community Call- January

Mark your calendars and join us for the next Power Apps Community Call on January 20th, 8a PST

PP Bootcamp Carousel

Global Power Platform Bootcamp

Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.

secondImage

Power Platform Community Conference On Demand

Watch Nick Doelman's session from the 2020 Power Platform Community Conference on demand!

Top Solution Authors
Top Kudoed Authors
Users online (5,734)