private void PlantTypes_SelectionChanged(object sender, SelectionChangedEventArgs e) { //get the related plant names for this type and populate the the PlantNames combo box KeyValuePair <long, string> s = (KeyValuePair <long, string>)((ComboBox)sender).SelectedValue; MainWindow wnd = Application.Current.MainWindow as MainWindow; List <PlantNameDTO> plantNames = wnd.GetPlantNamesByType(s.Key); ObservableCollection <KeyValuePair <long, string> > list2 = new ObservableCollection <KeyValuePair <long, string> >(); foreach (PlantNameDTO dto in plantNames) { list2.Add(new KeyValuePair <long, string>(dto.PlantNameId, dto.PlantName)); } this.PlantNames.ItemsSource = null; this.PlantNames.ItemsSource = list2; plantList = GetPlantsByType(s.Key).PlantInventoryList; list3.Clear(); foreach (PlantInventoryDTO plant in plantList) { list3.Add(plant); } this.PlantInventoryListView.ItemsSource = list3; }