tags:

views:

1279

answers:

1

I've got a comboBox on my form. if i select, let's say, 5th item in the ui, then programmatically set selected index to -1 it looks like the selected item was reset - the text is not displayed, if i view the items with a mouse the first item is the item with index zero. but if i click the arrow down button instead, the selected item will be the sixth one! ComboBox somehow remembers that the last selected item was the 5th and doesn't care about me resetting it. is there any solution to that issue? i would blame some binding stuff but i'm not really sure why is it happening.

+2  A: 

That's intended behaviour - you'll see that behaviour on any combo/dropdown box used anywhere in Windows. If you want to ensure the first item in the combo box is selected when you down-arrow, just set the selectedIndex to 0 that just before you set it to -1.

James Burgess