WPF RadioButton单选失效

文章目录

前言

我最近在照着教程敲代码,WPF深入讲解第8集。发现RadioButton按钮点击触发器不是单选的。WPF中单选和复选通过RadioButton和CheckButton来进行区分。我点击另一个RadioButton之后,之前的Radiobutton没有取消选择。

解决方案

在原来的代码上面天啊及GroupName,就能进行区分。例如如下

html 复制代码
<RadioButton GroupName="ListRadio"/>
<RadioButton GroupName="ListRadio"/>
<RadioButton GroupName="ListRadio"/>
<RadioButton GroupName="ListRadio"/>
<RadioButton GroupName="ListRadio"/>
<RadioButton GroupName="ListRadio"/>
<RadioButton GroupName="ListRadio"/>
相关推荐
小二·4 小时前
向量数据库深度对比:PGVector vs Qdrant vs Milvus vs Chroma(附性能测试数据)
数据库·wpf·milvus
周杰伦fans1 天前
WPF TextBlock 中 Run 元素实战——从密码强度检测到 MVVM 绑定
wpf
largecode2 天前
座机号码认证如何操作?申请热线实名名片,树立统一官方客服形象
linux·sql·华为·c#·.net·wpf·harmonyos
小满Autumn2 天前
WPF 入门:XAML 语法、布局与数据绑定
microsoft·c#·.net·wpf
小满Autumn2 天前
WPF 进阶:样式、触发器与控件模板
c#·.net·wpf
她说彩礼65万3 天前
WPF视觉树 逻辑树
wpf
贺国亚3 天前
分布式并发
分布式·wpf
Iawfy_3 天前
WPF的ComboBox绑定Enum枚举
wpf
她说彩礼65万3 天前
WPF TemplateBinding
wpf
她说彩礼65万3 天前
WPF 三大模板类型 四大属性名称
wpf