private void comboBoxChooseMom_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (comboBoxChooseMom.SelectedIndex != -1) { try { comboBoxChooseChild.ItemsSource = bl.getKids(a => a.idMom == Convert.ToInt64(comboBoxChooseMom.SelectedValue)); comboBoxChooseChild.DisplayMemberPath = "fullName"; comboBoxChooseChild.SelectedValuePath = "idChild"; comboBoxChooseChild.SelectedIndex = -1; contract = new BE.Contract(); contract.workBegin = DateTime.Today; contract.workEnd = DateTime.Today; addContractTab.DataContext = contract; mom = (BE.Mother)comboBoxChooseMom.SelectedItem; new Thread(() => { try { copNanny = bl.getAllCompatibleNanny(mom).ToList(); Dispatcher.Invoke(new Action(() => { dataGridDetalis.ItemsSource = copNanny; dataGridDetalis.SelectedValuePath = "nannyId"; })); } catch (Exception n) { MessageBox.Show(n.Message); } }).Start(); } catch (Exception n) { MessageBox.Show(n.Message); } } }