【发布时间】:2014-05-03 00:29:34
【问题描述】:
当然,我在网上到处搜索,但找不到解决问题的方法。
我的问题
我有一个包含听力图列表(Audiogramm 类)的患者类。 实际上,我可以在 DataGrid 中显示患者列表。但我想在 DataGrid (WPF) 中显示每位患者的听力图。
class Patient
{
public Patient(string patientid, string genre, string createdate)
{
this.patientID = patientid;
this.genre = genre;
this.createDate = createdate;
audiogram = new List<Audiogram>();
}
public string patientID { get; set; }
public string genre{ get; set; }
public string createDate { get; set; }
public List<Audiogram> audiogram { get; set; }
}
class Audiogram
{
public Audiogram(string typeData, string actionDate)
{
this.typeData = typeData;
this.actionData = actionData;
}
public string typeData { get; set; }
public string actionData { get; set; }
}
XmlNodeList nodeList = root.SelectNodes("/pt:NOAH_Patients_Export/pt:Patient/pt:Patient", nsmgr);
foreach (XmlNode node in nodeList)
{
XmlNodeList nodeListAudio = node.SelectNodes("//pt:Actions", nsmgr);
Patient patient = new Patient(node["pt:NOAHPatientId"].InnerText, node["pt:Gender"].InnerText, node["pt:CreateDate"].InnerText);
foreach (XmlNode nodeAudio in nodeListAudio)
{
Audiogram audiogramme = new Audiogram(nodeAudio["pt:TypeOfData"].InnerText, nodeAudio["pt:ActionDate"].InnerText);
patient.audiogram.Add(audiogramme);
}
listPatient.Add(patient);
}
dataGrid_XML.ItemsSource = listPatient;
【问题讨论】:
标签: c# wpf list binding datagrid