2
我想根据ListBoxItem的内容的IsEnabled属性来禁用ListBox项目。就像在这段代码中,按钮1有IsEnabled = False,但是列表框项是可选的。如果内容IsEnabled属性为false,我想禁用选择。如何触发搜索项目内容及其IsEnabled属性。如何在触发器ListBoxItem中找到子控件的IsEnabled属性
<Grid>
<ListBox>
<ListBox.ItemTemplate>
<DataTemplate>
<DataTemplate.Triggers>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="IsEnabled" Value="False"/>
</Trigger>
</DataTemplate.Triggers>
</DataTemplate>
</ListBox.ItemTemplate>
<ListBoxItem>
<Button IsEnabled="False">1</Button>
</ListBoxItem>
<ListBoxItem>
<Button>2</Button>
</ListBoxItem>
<ListBoxItem>
<Button>3</Button>
</ListBoxItem>
</ListBox>
</Grid>
中的同一个属性上,但这不是我想要实现的。我想获得子控件的IsEnabled属性。 我正在使用MVVM,但我想在我的资源字典中使用触发器。 – DronBoard 2012-03-21 13:58:19