This is my ComboBox:
<ComboBox x:Name="comboBoxExchange" HorizontalAlignment="Left" Margin="167,162,0,0" VerticalAlignment="Top" Width="222" SelectedItem="{Binding Exchange}"/>
This is the code I use to initialize the ComboBox:
private void InitExchange()
{
comboBoxExchange.ItemsSource = (from p in m_DbSession.Query<Exchange>() orderby p.Name select p);
comboBoxExchange.DisplayMemberPath = "Name";
comboBoxExchange.SelectionChanged += comboBoxExchange_SelectionChanged;
}
So I want to save my data after the user changes the selection with this function:
private void Save()
{
using (var transaction = m_DbSession.BeginTransaction())
{
m_DbSession.SaveOrUpdate(m_DBProduct);
transaction.Commit();
}
}
The problem is that I cant find the event that works with this.
- SelectionChanged is fired when the window is loaded without the user doing anything
- LostFocus is fired multible times even when the user just "opens" the combobox and closes it without changing anything.
SelectedItem="{Binding Exchange}"- so track changes of Exchange property - ASh