私が持っていると想像してみましょう:
<RadioButton GroupName="Group1" IsChecked="{Binding Path=RadioButton1IsChecked}" />
<RadioButton GroupName="Group1" IsChecked="{Binding Path=RadioButton2IsChecked}" />
そして、私のデータソースクラスには次のものがあります:
public bool RadioButton1IsChecked { get; set; }
public bool RadioButton2IsChecked { get; set; }
public enum RadioButtons { RadioButton1, RadioButton2, None }
public RadioButtons SelectedRadioButton
{
get
{
if (this.RadioButtonIsChecked)
return RadioButtons.RadioButton1;
else if (this.RadioButtonIsChecked)
return RadioButtons.RadioButton2;
else
return RadioButtons.None;
}
}
SelectedRadioButton
ラジオボタンをプロパティに直接バインドできますか? RadioButton1IsChecked
選択したラジオボタンを計算するためだけにRadioButton2IsChecked
プロパティが本当に必要です。