Selection bug for listbox where the list items are value types / structs and contain duplicates?
I turned an Horizontal ItemsControl to a Listbox so that I am able to select individual items but found that the selection was broken. Took some time to distill out the problematic bit. Books = new[] { new Book{Id=1, Name="Book1"}, new Book{Id=2, Name="Book2"}, new Book{Id=3, Name="Book3"}, new Book{Id=4, Name="Book4"}, new Book{Id=3, Name="Book3"}, }; <DataTemplate DataType="{x:Type WPF_Sandbox:Book}"> <TextBlock Text="{Binding Name}"/> </DataTemplate> <ListBox ItemsSource="{Binding Books}"/> If Book is a struct, the listbox selection (default mode : single) goes awry if you select an item