I am working on a wpf application, when using Combo Box control i am assigning ItemsSource to it. So, it displays a list of items with no item selected, now user can select an item of his choice. When user has made a selection he has no option to undo that. I want him to be able to get the initial state where no item is selected. How can i do that?
There are multiple ways that would also be similar in windows forms programming. You could do either of the following:
1) Add a blank or --None-- record to your combobox datasource that is the default record.
2) You could monitor the keypress event and say use the ESC key to reset the selected index back to -1.
3) If your combobox allows typing you could also allow them to clear the text and onleave if the text field is blank set the selectedindex back to -1 so that it does not get reset to the selected value.
Alot of the time my users prefer option 1 but that's my users.
That should give you some options.