找回密码
 立即注册

QQ登录

只需一步,快速开始

zxc9089
中级会员   /  发表于:2015-1-16 14:14  /   查看:4647  /  回复:3
C1 WPF中有没有控件能够实现类似 RadioButton 最后一项为其他可手写输入的方法? 如下图:




如何获取到这一组选中的值?

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?立即注册

x

3 个回复

倒序浏览
Alice
社区贡献组   /  发表于:2015-1-16 16:54:00
沙发
回复 1楼zxc9089的帖子

基于WPF的平台,是可以实现的。
可以使用C1List控件,C1ListBoxItem就是一个RadioButton。WPF平台下控件的模板是可以定制的。模板定制的时候可以放置TextBox作为输入控件。
代码参考:
  1.         <c1:C1ListBox Name="c1List" Orientation="Horizontal" HorizontalAlignment="Left" Height="120" Margin="57,57,0,0" VerticalAlignment="Top" Width="324" >
  2.             <c1:C1ListBoxItem>
  3.                 <RadioButton>1L</RadioButton>
  4.             </c1:C1ListBoxItem>
  5.             <c1:C1ListBoxItem>
  6.                 <RadioButton>2L</RadioButton>
  7.             </c1:C1ListBoxItem>        
  8.             <c1:C1ListBoxItem>
  9.                 <RadioButton >
  10.                     <Grid>
  11.                         <Grid.ColumnDefinitions>
  12.                             <ColumnDefinition Width="Auto" />
  13.                             <ColumnDefinition Width="130*" />
  14.                         </Grid.ColumnDefinitions>
  15.                         <TextBlock Grid.Column="0" >Others:</TextBlock>
  16.                         <TextBox Grid.Column="1" Margin="10,0,0,0" Width="120"></TextBox>
  17.                     </Grid>
  18.                 </RadioButton>                    
  19.             </c1:C1ListBoxItem>
  20.         </c1:C1ListBox>
复制代码


C1ListBox.SelectedItem属性可以获取选中的值。
请点击评分,对我的服务做出评价!  5分为非常满意!

葡萄城控件服务团队

官方网站: http://www.gcpowertools.com.cn
回复 使用道具 举报
zxc9089
中级会员   /  发表于:2015-1-16 17:43:00
板凳
这样的话 C1ListBoxItem的选中和里面的radiobutton的选中不是对等的,C1ListBoxItem选中了并不等于radiobutton选中。 还有 SelectedItem的结果是 RadioButton而不是所希望得到的值。
回复 使用道具 举报
Alice
社区贡献组   /  发表于:2015-1-16 19:15:00
地板
回复 3楼zxc9089的帖子

C1ListBox不能支持实现你的需求,必须自己写逻辑去实现,我这里没有已经实现了示例。
上述代码只是思路,要想实现这个需求,还需要做代码的调整和更改。比如要将RadioButton的IsChecked和C1ListBoxItem的IsSelected进行TwoWays的绑定。
请点击评分,对我的服务做出评价!  5分为非常满意!

葡萄城控件服务团队

官方网站: http://www.gcpowertools.com.cn
回复 使用道具 举报
您需要登录后才可以回帖 登录 | 立即注册
返回顶部