//private void Searchbox_TextChanged(object sender, TextChangedEventArgs e) //{ // var binding = ((TextBox)sender).GetBindingExpression(TextBox.TextProperty); // binding.UpdateSource(); //} private void PatientDataGrid_MouseDoubleClick(object sender, MouseButtonEventArgs e) { if (patientDataGrid.SelectedItem != null) { var v = new PatientDetails(); var vm = new VMPatientEdit(); vm.P = (Patient)patientDataGrid.SelectedItem; vm.IstInEditMode = true; v.DataContext = vm; v.ShowDialog(); if (v.DialogResult == true) // Save in Dialogbox clicked and inputs valid { using (KlinikDbEntities db = new KlinikDbEntities()) { db.Entry(vm.P).State = EntityState.Modified; db.SaveChanges(); //PropertyChanged(this, new PropertyChangedEventArgs("PatientExams")); } } else { //PropertyChanged(this, new PropertyChangedEventArgs("PatientExams")); } } }
private void save_Click(object sender, RoutedEventArgs e) { int anz = db.SaveChanges(); info.Text = anz + " Rows affected!"; }