troubleshooting Question

WPF Listbox Selection

Avatar of Howard Bash
Howard BashFlag for United States of America asked on
C#Visual C++.NETMicrosoft Development
14 Comments1 Solution865 ViewsLast Modified:
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
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 14 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 14 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros