Fail ItemsControl binding
I define this class :
class myClas开发者_如何学JAVAs { string Key {get;set;} }
and the ItemsControl
<ItemsControl Name="itemsControl" >
<ItemsControl.Items>
<RadioButton Content="{Binding Key}" />
</ItemsControl.Items>
</ItemsControl>
Now, I try to call the binding in the code ( itemsControl.ItemsSource or itemsControl.DataContext ) but its not working ( i trying to bind some list of myClass to the itemsControl )
You need to put the radio button inside the itemTemplate tag not the items tag
try <ItemsControl.ItemTemplate/> <DataTemplate ...
精彩评论