Goal: issue an event when items in a combobox drop down list is selected.
Problem: Using \"SelectionChanged\", however, if the user
I hope that you will find helpfull the following trick.
You can bind both the events
combobox.SelectionChanged += OnSelectionChanged;
combobox.DropDownOpened += OnDropDownOpened;
And force selected item to null inside the OnDropDownOpened
private void OnDropDownOpened(object sender, EventArgs e)
{
combobox.SelectedItem = null;
}
And do what you need with the item inside the OnSelectionChanged. The OnSelectionChanged will be raised every time you will open the combobox, but you can check if SelectedItem is null inside the method and skip the command
private void OnSelectionChanged(object sender, SelectionChangedEventArgs e)
{
if (combobox.SelectedItem != null)
{
//Do something with the selected item
}
}