I'm not entirely sure what I'm doing incorrect but it appears that my style trigger is not being recognized. I want to change the color of the Stroke when the listbox item is selected.
<ListBox ItemsSource="{Binding CityList}" DisplayMemberPath="Name" SelectionMode="Extended" VirtualizingPanel.IsVirtualizing="true" VirtualizingPanel.VirtualizationMode="Recycling" Background="Brown"> <ListBox.ItemContainerStyle> <Style TargetType="{x:Type ListBoxItem}"> <Setter Property="Canvas.Left" Value="{Binding Longitude, Converter={StaticResource longValueConverter}, ConverterParameter={StaticResource mapWidth}}"/> <Setter Property="Canvas.Top" Value="{Binding Latitude, Converter={StaticResource latValueConverter}, ConverterParameter={StaticResource mapHeight}}"/> <Setter Property="BorderThickness" Value="3" /> <Setter Property="ContentTemplate"> <Setter.Value> <DataTemplate> <Grid> <Ellipse x:Name="indicator" Fill="#FF000000" Height="10" Width="10" Stroke="Transparent" StrokeThickness="2"/> </Grid> </DataTemplate> </Setter.Value> </Setter> <Style.Triggers> <Trigger Property="IsSelected" Value="True"> <Setter TargetName="indicator" Property="Stroke" Value="Red"/> </Trigger> </Style.Triggers> </Style> </ListBox.ItemContainerStyle> <ListBox.ItemsPanel> <ItemsPanelTemplate> <Canvas IsItemsHost="True" Width="{StaticResource mapWidth}" Height="{StaticResource mapHeight}"/> </ItemsPanelTemplate> </ListBox.ItemsPanel> </ListBox>
strokeitself, and target that with the setter. msdn.microsoft.com/en-us/library/…