tags:

views:

44

answers:

2

What event do I have to listen for, to get notified when a user selects an option from a (editable) WPF ComboBox control?

Do I have to access the Items property first to then listen to Items.CurrentChanged? And if so, how do I add that listener in XAML?

+3  A: 

How about the SelectionChanged event?

EDIT: Added a simple example

<ComboBox SelectionChanged="ComboBox_SelectionChanged"/>

and in code-behind:

private void ComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
}
Goblin
Ahh, how could I not see that.. Thanks!
poke
+1  A: 

if you are looking to do it in MVVM then its:

<ComboBox SelectedItem={Binding Path=SelectedItem}/>

assuming you have a SelectedItem property in your ViewModel set to the proper objectType.

ecathell