private async void Button_Delete(object sender, RoutedEventArgs e) { await AppViewModel.DeleteManagedCertificate(ItemViewModel.SelectedItem); if (ItemViewModel.SelectedItem?.Id == null) { AppViewModel.SelectedItem = AppViewModel.ManagedCertificates.FirstOrDefault(); } }