RadioButton

it2022-06-23  84

同属一个GroupName则互斥,只能选择一个

<StackPanel Orientation="Vertical"> <Label Content="Group1:水果"></Label> <RadioButton GroupName="Group1" Content="苹果"></RadioButton> <RadioButton GroupName="Group1" Content="荔枝"></RadioButton> <RadioButton GroupName="Group1" Content="西瓜"></RadioButton> <RadioButton GroupName="Group1" Content="香蕉"></RadioButton> <Label Content="Group2:科目"></Label> <RadioButton GroupName="Group2" Content="语文"></RadioButton> <RadioButton GroupName="Group2" Content="数学"></RadioButton> <RadioButton GroupName="Group2" Content="英语"></RadioButton> <RadioButton GroupName="Group2" Content="物理"></RadioButton> </StackPanel>

上面的示例中,可以选择水果、科目下各一个选项,所以水果和科目不互斥,水果之间互斥,科目之间互斥

   

 

示例代码

https://github.com/zLulus/NotePractice/tree/dev3/WPF/WpfDemo/RadioButton

转载于:https://www.cnblogs.com/Lulus/p/8151410.html

相关资源:C# WinForm 自定义 RadioButton

最新回复(0)