你PatientViewModel
应该是这样的
public class PatientViewModel: INotifyPropertyChanged { public int ID {get; set;} public string FirstName {get; set;} public string LastName {get; set;} //Each patient has a set of test results, so we create a list. public ListPatientTestResults {get; set;} }
你应该再增加一个包含集合的类PatientViewModel
.
public class AllPatients { public ObservableCollectionAllPatients{get; set;} public PatientViewModel SelectedPatient {get; set;} }
您的Window类现在应该如下所示