开发者

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 ...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜