public Window2(MainWindow per, BdClass.Main ch) { InitializeComponent(); B = per; adress.ItemsSource = B.adress.ItemsSource; btOK.Content = "Изменить"; Ch = ch; try { for (int i = 0; i < adress.Items.Count; i++) { var kkk = (BdClass.Adress)adress.Items[i]; if (kkk.Id == Ch.Adress.Id) { adress.SelectedIndex = i; break; } } if (Ch != null) telephone.Text = Ch.Telephone; if (Ch != null) castomer.Text = Ch.Customer; if (Ch != null) SPCH_Unchecked(null, null); } catch (Exception exp) { MessageBox.Show(exp.Message); } }
public Window2(MainWindow b) { InitializeComponent(); B = b; btOK.Content = "Добавить"; adress.ItemsSource = B.adress.ItemsSource; adress.SelectedIndex = 0; SPCH_Unchecked(null, null); }