好的,我有ListView
。我已从代码中设置ItemsSource
。此ListView
具有属性SelectionMode="Multiple"
。但我想禁用某些项目。
XAML: //not working
<ListView x:Name="MyListView" SelectionMode="Multiple">
<ListView.ItemContainerStyle>
<Style TargetType="ListViewItem">
<Setter Property="IsEnabled" Value="{Binding Path=enabled, Mode=TwoWay}" />
</Style>
</ListView.ItemContainerStyle>
<ListView.ItemTemplate>
<!-- my template -->
</ListView.ItemTemplate>
</ListView>
虽然,我无法从代码中设置每个ListViewItem ......