WPF ListBox SelectedIndex issue
Posted on 2016-07-27
I am setting the selected index of a bound listbox in my code behind in response to some processing that has happened. I can trace the code through and it is only setting the selected index once, the changed event for the selected index fires twice, the first time it is the value my code sets it to and the second time it is -1.
Since the code to do this is through a mixture of several objects it is hard to post an example here. Perhaps someone can give me a clue of how to debug this, or suggest why the selection I make is apparently getting reset by the listbox.