morphinapg
morphinapg

Reputation: 109

I need to be able to type into the ComboBox without it causing a SelectionChanged event

I have a ComboBox which acts as a list of profiles. When the user clicks the drop down list, and selects a profile, it loads settings based on that profile. I want the user to be able to modify the settings, and save them as their own profile. To do that, I want them to name their profile by typing into the ComboBox. The problem is, while typing, the SelectionChanged event is triggering, causing any profiles with similar names to load. I need the user to be able to type into the combobox, without it selecting one of the items. Or, I need to make the code that is triggered on SelectionChanged event only trigger when the user has selected an item by clicking it on the drop down box.

Upvotes: 3

Views: 287

Answers (1)

makc
makc

Reputation: 2579

you can define a local bool variable m_dontHandleSelection and set it to true before you update the combo in yore code behind.

that way you can check it in the SelectionChanged handler and return without doing anything, except setting the boolean to false

Upvotes: 1

Related Questions