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

Re: Change color of shape based on radio button

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

Re: Change color of shape based on radio button

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.

Highlighted
Post Prodigy
Post Prodigy

Re: Change color of shape based on radio button

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

Highlighted
Responsive Resident
Responsive Resident

Re: Change color of shape based on radio button

@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

Highlighted
Post Prodigy
Post Prodigy

Re: Change color of shape based on radio button

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 

Highlighted
Responsive Resident
Responsive Resident

Re: Change color of shape based on radio button

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)

Highlighted
Responsive Resident
Responsive Resident

Re: Change color of shape based on radio button

@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 👍

 

Highlighted
Post Prodigy
Post Prodigy

Re: Change color of shape based on radio button

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
secondImage

New Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

Experience what’s next for Power Apps

Join us for an in-depth look at the new Power Apps features and capabilities at the free Microsoft Business Applications Launch Event.

Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (8,680)