private void CboAllPatients_SelectionChanged(object sender, SelectionChangedEventArgs e) { //Obtain the view model dataContext UltimateMedDBWPFClient.Labs.LabViewModel currentViewModel = (UltimateMedDBWPFClient.Labs.LabViewModel)DataContext; if (currentViewModel != null) { var a = currentViewModel.LabsByPatient; //Assign the ItemsSource of the Patient's Labs DataGrid to the newly obtained object DgLabs.ItemsSource = a; DgLabs.Items.Refresh(); UltimateMedDB.Business.Patient selectedPatient = currentViewModel.SelectedPatient; PatientName.Text = selectedPatient.Name; PatientAge.Text = (selectedPatient.Age).ToString(); PatientGender.Text = selectedPatient.Gender; PatientPhone.Text = selectedPatient.Phone; PatientWeight.Text = (selectedPatient.Weight).ToString(); PatientAddress.Text = selectedPatient.Address; PatientDocId.Text = selectedPatient.Doc_Id; PatientDisease.Text = selectedPatient.Disease; } }
private void CboAllPatients_SelectionChanged(object sender, SelectionChangedEventArgs e) { //Obtain the view model dataContext UltimateMedDBWPFClient.Rooms.RoomViewModel currentViewModel = (UltimateMedDBWPFClient.Rooms.RoomViewModel)DataContext; if (currentViewModel != null) { UltimateMedDB.Business.Patient selectedPatient = currentViewModel.SelectedPatient; PatientName.Text = selectedPatient.Name; PatientAge.Text = (selectedPatient.Age).ToString(); PatientGender.Text = selectedPatient.Gender; PatientPhone.Text = selectedPatient.Phone; PatientWeight.Text = (selectedPatient.Weight).ToString(); PatientAddress.Text = selectedPatient.Address; PatientDocId.Text = selectedPatient.Doc_Id; PatientDisease.Text = selectedPatient.Disease; } }