我定义这个类:
类密钥{ string myClass {get;set;} }
和ItemsControl
<ItemsControl Name="itemsControl" >
<ItemsControl.Items>
<RadioButton Content="{Binding Key}" />
</ItemsControl.Items>
</ItemsControl> 现在,我尝试在代码( itemsControl.ItemsSource或itemsControl.DataContext )中调用绑定,但它不起作用(我尝试将一些myClass列表绑定到itemsControl )
发布于 2011-05-08 20:53:00
您需要将单选按钮放在itemTemplate标记内,而不是放在items标记内
试试<ItemsControl.ItemTemplate/> <DataTemplate ...
https://stackoverflow.com/questions/5927418
复制相似问题