I have:
In the xaml.cs code I tried:
gRBuEradicatedBlueCities.Background = #ffffff;
which does not work.
How do I programmatically change a RadioButton Background?
I have:
In the xaml.cs code I tried:
gRBuEradicatedBlueCities.Background = #ffffff;
which does not work.
How do I programmatically change a RadioButton Background?
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Amit MohantyPosted May 20, 2025, 5:05 AM
To programmatically change the Background of a RadioButton, you need to assign a Brush object, not a raw color string.
Blocked AccountPosted May 20, 2025, 12:03 PM
You can’t directly assign a color code like
#ffffffto change the background in C#. Instead, you need to use aBrushobject as Amit suggested. For example, to set the background to white, you can write: