private void AddVehicle_Click(object sender, RoutedEventArgs e) { AddVehicle window = new AddVehicle(); if (window.ShowDialog().Value) { this.TransportViewModel.Vehicles.Add(window.DataContext as VehicleInfo); } }