private async void OpenRental_Executed(object sender, ExecutedRoutedEventArgs e) { var equipment = dgAvailableEquipment.SelectedItem as Equipment; var window = new RentalWindow(RentalService, equipment); window.ShowDialog(); // Update the view model. ViewModel.AvailableEquipment.Clear(); ViewModel.Rentals.Clear(); await LoadDataAsync(); }