I want to have a radio button group that you can unselect them. First I used radio but when you select a radio you can only unselect it by selecting another one. I want radio that you can unselect all of the options. I cant use checkbox either because you can choose multiple options in checkbox.
RadioButton radio= new RadioButton();
radio.Content = item;
textBox.GroupName = "Group1" + Id;
But unfortunately it throws an error saying that checkbox can't have a group name. If I admit the group name you can select more than one option. Is there any way you can have something that you can unselect an option but you wouldn't be able to select more than one option?
Use a custom class instead of RadioButton:
public class OffRadioButton : RadioButton
{
protected override void OnClick()
{
bool? isChecked = IsChecked;
base.OnClick();
if (isChecked == true)
IsChecked = false;
}
}