加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

c# – WPF:如何让Radiobuttons显示为ToggleButtons的水平行

发布时间:2020-12-15 17:48:01 所属栏目:百科 来源:网络整理
导读:我目前正在构建一个将用于触摸屏的UI.因此,我想将任何RadioButton组显示为ToggleButtons的水平行.我已经想出了如何显示ToggleButtons而不是标准项目符号: Style x:Key="{x:Type RadioButton}" TargetType="{x:Type RadioButton}" BasedOn="{StaticResource
我目前正在构建一个将用于触摸屏的UI.因此,我想将任何RadioButton组显示为ToggleButtons的水平行.我已经想出了如何显示ToggleButtons而不是标准项目符号:
<Style x:Key="{x:Type RadioButton}" 
           TargetType="{x:Type RadioButton}" 
           BasedOn="{StaticResource {x:Type ToggleButton}}">

但是,这将显示一列ToggleButtons,而不是一行.
你知道一个简单的方法吗?

非常感谢!

解决方法

将单选按钮放在StackPanel中,并将Orientation设置为Horizo??ntal.
<StackPanel Orientation="Horizontal">
   <RadioButton Content="1"/>
   <RadioButton Content="2"/>
   <RadioButton Content="3"/>
</StackPanel >

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读