private void ButtonAdd_Click(object sender, RoutedEventArgs e) { Car car = new Car(); car.DateSell = DateTime.Now; WindowChild child = new WindowChild(car); if (child.ShowDialog() == true) { cars.Add(car); } }
private void ButtonChange_Click(object sender, RoutedEventArgs e) { if (listCar.SelectedIndex != -1) { Car car = listCar.SelectedItem as Car; WindowChild child = new WindowChild(car); if (child.ShowDialog() == true) { cars[listCar.SelectedIndex] = car; } } }