I am trying to select item in ListBox in program, but I was so far unable to do so.
I looked for the answer but everything I found was to use ListBox.SetSelected() method, but I don't have anything like that awaiable.
I discovered that there are two completely different ListBoxes and I am using the second one:
System.Windows.Forms.ListBox
System.Windows.Controls.ListBox
All items in the ListBox are added via Binding, which doesn't help either. Any ideas?
EDIT :
I just found that this works:
listBox.SelectedIndex = 5;
listBox.UpdateLayout();
listBox.Focus();
Apparently, I was missing the last method, which sets the highlight to the selected item, which was updating fine even before.