I am trying to disable the ListBox item depending on IsEnabled property of ListBoxItem's content. Like in this code the button 1 has IsEnabled=False but list box item is selectable. I want to disable the selection if contents IsEnabled property is false. how should trigger search for the item content and its IsEnabled property.
<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>