xaml:
C#:
gRBuEradicatedBlueCities.Background = (SolidColorBrush)(new BrushConverter().ConvertFrom("#0000ff"));
gRBuEradicatedBlueCities.Checked = false;
Why does the radio button ".Checked" result in an error?
Error CS0079 The event 'ToggleButton.Checked' can only appear on the left hand side of += or -=
Amira BedhiafiPosted Apr 14, 2026, 12:05 PM
Simply because Checked is an event not a boolean property and in C#,events can only be used with += or -= to attach or remove handlers which is why gRBuEradicatedBlueCities.Checked = false gives CS0079. RadioButton uses the IsChecked property to store whether it is selected.
https://learn.microsoft.com/en-us/dotnet/api/system.windows.controls.radiobutton?view=windowsdesktop-10.0
so try this instead:
and if you want to react when the radio button becomes checked then use the event like this:
and define: