I have a WPF application with a listbox. I click a button, add several items to the list and then subsequenly click an item, get back the row number and do some other calcs with that number.
For some reason, when I click the listbox item, it doesn't unselect a previous item and further sometimes highlights several rows in the listbox.
private void listBox1_SelectionChanged(object sender, SelectionChangedEventArgs e)
ListBox lb = (ListBox)sender;
int n = lb.SelectedIndex;
//some stuff not related to listbox follows