同屬一個(gè)GroupName則互斥,只能選擇一個(gè)
<StackPanel Orientation="Vertical">
<Label Content="Group1:水果"></Label>
<RadioButton GroupName="Group1" Content="蘋(píng)果"></RadioButton>
<RadioButton GroupName="Group1" Content="荔枝"></RadioButton>
<RadioButton GroupName="Group1" Content="西瓜"></RadioButton>
<RadioButton GroupName="Group1" Content="香蕉"></RadioButton>
<Label Content="Group2:科目"></Label>
<RadioButton GroupName="Group2" Content="語(yǔ)文"></RadioButton>
<RadioButton GroupName="Group2" Content="數(shù)學(xué)"></RadioButton>
<RadioButton GroupName="Group2" Content="英語(yǔ)"></RadioButton>
<RadioButton GroupName="Group2" Content="物理"></RadioButton>
</StackPanel>
上面的示例中,可以選擇水果、科目下各一個(gè)選項(xiàng),所以水果和科目不互斥,水果之間互斥,科目之間互斥

1
示例代碼
https://github.com/zLulus/NotePractice/tree/dev3/WPF/WpfDemo/RadioButton