Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/silverlight/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Silverlight 失败项控件绑定_Silverlight - Fatal编程技术网

Silverlight 失败项控件绑定

Silverlight 失败项控件绑定,silverlight,Silverlight,我定义这个类: 类myClass { 字符串键{get;set;} } 和ItemsControl <ItemsControl Name="itemsControl" > <ItemsControl.Items> <RadioButton Content="{Binding Key}" /> </ItemsControl.Items> </ItemsContr

我定义这个类:

类myClass { 字符串键{get;set;} }

和ItemsControl

<ItemsControl Name="itemsControl" >   
    <ItemsControl.Items>             
            <RadioButton Content="{Binding Key}" />     
    </ItemsControl.Items> 
</ItemsControl> 


现在,我尝试在代码中调用绑定(itemsControl.ItemsSource或itemsControl.DataContext),但它不起作用(我尝试将myClass的一些列表绑定到itemsControl)

您需要将单选按钮放在itemTemplate标记内,而不是items标记内

试试