In my XAML file, I have a ListBox declared as follows:
<ListBox x:Name="lstDeck" Height="280" ItemsSource="{Binding Path=Deck}" > <ListBox.ItemTemplate> <DataTemplate> <ListBoxItem Content="{Binding}" /> </DataTemplate> </ListBox.ItemTemplate> </ListBox>
In my view model, Deck is an ObservableCollection, so the binding directly displays the contents of my collection.
But when I have several values ββthat have the same value (for example, "10" six times), the choice in the ListBox has a strange behavior: it selects 2-3 elements, not just the one I clicked on.
Also, when I click on another listBoxItem, it does not focus the previous selected one.
Then it is impossible to see which element is actually selected, and it is impossible to get the value SelectedIndex.
Does anyone have an idea?
source share