I have xml file contains data, I serialize this file and set to List and adding all patient items to treeview within for loop All items looks fine but there is no expand arrow... I need these items with expand button for all and first item expanded in first view. How can I do this
namespace WpfApplication1
{
[Serializable, XmlRoot("patients")]
public class patients
{
[XmlElement("patient")]
public List<patient> patients_list { get; set; }
}
public class patient
{
[XmlElement("firstname")]
public string name { get; set; }
[XmlElement("lastname")]
public string surname { get; set; }
[XmlElement("age")]
public int age { get; set; }
public string gender { get; set; }
[XmlArray("exams"), XmlArrayItem("exam")]
public List<exam> exam { get; set; }
}
public class exam
{
[XmlElement("id", IsNullable = false)]
public int id { get; set; }
[XmlIgnore]
public DateTime date { get; set; }
[XmlElement("date")]
public string DateString
{
get
{
return XmlConvert.ToString(date, XmlDateTimeSerializationMode.Utc);
}
set
{
// You will need to check whether the dates and times in your XML file are in universal time or local time!
date = DateTime.Parse(value, CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal | DateTimeStyles.AdjustToUniversal);
}
}
[XmlElement("comment")]
public string comment { get; set; }
}
}
and the code piece that I add nodes to tree(all items contains sub items and sub list items..)
DataReader readXML = new DataReader();
List<patient> items = readXML.ReadXML();
foreach(patient item in items)
{
trvMenu.Items.Add(item);
}