Scott White
Scott White

Reputation: 610

Handle Click Event on Item in a ComboBox

Does anyone know of any event or sequence of events to be able to handle when a user clicks an item in a ComboBox? Currently the only events that I see being fire from ComboBox within WinForms is SelectedIndexChanged or SelectedValueChanged. The problem with these events is that they are also fired under many other scenerios such as when the user presses up or down arrow (even if the ComboBox is not open).

ComboBox.SelectedIndexChanged += (o, e) => Console.WriteLine("ComboBox_SelectedIndexChanged");
ComboBox.SelectedValueChanged += (o, e) => Console.WriteLine("ComboBox_SelectedValueChanged");

Any thoughts?

Upvotes: 7

Views: 17328

Answers (1)

Jeff Ogata
Jeff Ogata

Reputation: 57833

If you are asking about when the user clicks an item in the ComboBox to select it, you can use the ComboBox.SelectionChangeCommitted event.

Upvotes: 8

Related Questions