i'm working on a Project where i need to display a ComboBox into a ListView, the ComboBox is Bound using TwoWay Mode. I need to fire an event whenever the Combobox selection changes and get the selected item of the selected ComboBox from the listview.
I need to select this item, whenever the combobox selection change event is fired, so i can get the selected item.
EDIT: this is the event code.
private void ProductTypeComboBox_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
{
ComboBox combo = e.OriginalSource as ComboBox;
ComboBoxItem cbItem = (ComboBoxItem) combo.SelectedItem;
string selected = cbItem.Content.ToString();
switch (selected)
{
case "Vente" :
var pro = this.ProductsToAddListView.SelectedItem;
break;
default:
MessageBox.Show("Error", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
break;
}
}