In my ListBox I wanted to bind the IsSelected property of each item to my ViewModel, and did so successfully. Then I wanted to make selected items more visible when they don't have keyboard focus, and this answer told me how to do so. Either feature alone works, but combining them causes the following exception on startup:
XamlParseException: A 'Binding' cannot be set on the 'Value' property of type 'Setter'. A 'Binding' can only be set on a DependencyProperty of a DependencyObject.
Here's my XAML:
<ListBox x:Name="objectList" ItemsSource="{Binding FilteredList}" SelectionMode="Extended">
<ListBox.ItemContainerStyle>
<Style TargetType="{x:Type ListBoxItem}">
<Style.Resources>
<!--Make unfocused selected items more visible-->
<SolidColorBrush x:Key="{x:Static SystemColors.ControlBrushKey}" Color="LightBlue" Opacity=".5"/>
</Style.Resources>
<!-- Support multiselect-->
<Setter Property="IsSelected" Value="{Binding IsSelected}"/>
</Style>
</ListBox.ItemContainerStyle>
</ListBox>