【发布时间】:2011-06-07 06:52:04
【问题描述】:
我有一个 Listbox,它的 ItemsSource 属性数据绑定到一组对象。集合中的每个对象都有一个Enabled 属性,我想将其绑定到它们各自的ListboxItem。我试过这种方法:
<ListBox ItemsSource="{Binding MyList}">
<ListBox.ItemContainerStyle>
<Style TargetType="ListBoxItem">
<Setter Property="IsEnabled" Value="{Binding Enabled}" />
</Style>
</ListBox.ItemContainerStyle>
</ListBox>
这会导致 AG_E_RUNTIME_MANAGED_UNKNOWN_ERROR 在这一行失败:
<Setter Property="IsEnabled" Value="{Binding Enabled}" />
如何绑定到 ListboxItems 上的 IsEnabled 属性(使用 Windows Phone 7)?
【问题讨论】:
标签: c# xaml data-binding windows-phone-7