Reputation: 14389
Excuse my question it is extreme simple or even silly but its been bothering me for the last hour and I can't get it going.
I have defined a list of of RadiButtons and a have added 4 radiobuttons
:
List<RadioButton> PortRadio = new List<RadioButton>();
PortRadio.Add(radioButton5);
PortRadio.Add(radioButton6);
PortRadio.Add(radioButton7);
PortRadio.Add(radioButton8);
On my code in 2 of the 4 of them (radioButton5 and radioButton6) I set:
///I am inside a for loop
PortRadio[i].IsChecked = true;
PortRadio[i].Content = "ACTIVE";
When I running The program the result is the following:
"Checked"
"Checked"
but Radiobutton 5 gets UncheckedThis behaviour is like a have set the radiobuttons to a listbox
with a selectionmode
set to single
, but thats not the case and furthemore I dont know whats causing this behaviour and how to overcome it.
Upvotes: 1
Views: 377
Reputation: 12766
The point of a RadioButton
is that you can only select 1 in a group. If you want to be able to select multiple, use different group names for the buttons, or even better, use a CheckBox
a checkbox is group independent.
Upvotes: 2