Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I know when a value is "re-selected" in a ComboBox?

I am using a ComboBox to insert a text template into a RichEdit control (the name of the template is in the picklist for the ComboBox.)

It all works great except when the user selects the same value in the list again. Then the SelectionChanged is not firing. That makes sense based on the name of the event (SelectionChanged), but I need to know that the value was re-selected so I can insert it again.

Is there a way to know that an item was re-selected from the ComboBox? (Or a better control to use?)

I tried using the DropDownClosed event, but that fires even if the item was not re-selected. (They open the drop down then click on another control.)

like image 447
Vaccano Avatar asked Jan 14 '13 20:01

Vaccano


People also ask

Which event can be used to detect changes in list combo box selection?

ComboBox. SelectedIndexChanged Event (System.

What happens when we select a value from a combo box in WPF?

Selected and Current Item Text property of ComboBox represents the text of the current selected item in a ComboBox. SelectedItem represents the first item in the currently selected items in a ComboBox. SelectedValue represents the value of the currently selected item in a ComboBox.

Which of the following event is triggered when the selection of item in a ComboBox is changed?

cs to sniff PreviewMouseLeftButtonDownEvent for all ComboBoxItem , then trigger the SelectionChangedEvent if the selecting item is the same as the selected item, i.e. the selection is performed without changing index.


1 Answers

It sounds like the way you are using your combo box isn't consistent with normal usage. Would it work to have a button next to the combo box that inserted the selected template. I think that behavior would work better for users who are familiar with the behavior of Google search with search sugestions

like image 187
BenCamps Avatar answered Oct 15 '22 10:10

BenCamps