private void EditDonation(object sender, MouseButtonEventArgs e) { DataGrid dg = sender as DataGrid; DonationsGrid p = (DonationsGrid)dg.SelectedItems[0]; // OR: Patient p = (Patient)dg.SelectedItem; UpdateDonation up = new UpdateDonation(p); up.DeleteDon.IsEnabled = false; up.DonationDate.SelectedDate = p.DonationDate; up.ShowDialog(); }
private void EditDonation(object sender, MouseButtonEventArgs e) { try { DataGrid dg = sender as DataGrid; DonationsGrid p = (DonationsGrid)dg.SelectedItems[0]; // OR: Patient p = (Patient)dg.SelectedItem; UpdateDonation up = new UpdateDonation(p); up.DonationDate.SelectedDate = p.DonationDate; up.ShowDialog(); Refresh_DonationGrid(sender, e); } catch (Exception error) { MessageBox.Show("could not edit"); } }
private void EditDonation(object sender, MouseButtonEventArgs e) { try { DataGrid dg = sender as DataGrid; DonationsGrid p = (DonationsGrid)dg.SelectedItems[0]; // OR: Patient p = (Patient)dg.SelectedItem; UpdateDonation up = new UpdateDonation(p); up.DeleteDon.IsEnabled = false; up.DonationDate.SelectedDate = p.DonationDate; up.ShowDialog(); Refresh_DonationsGrid(sender, e); } catch { } }