I want to populate my listview with data from a XML file, which is also generated with this program.
This code only adds the first entry of the XML file. But why?
XDocument document = XDocument.Load(@path + projectName +".xml");var items = from item in document.Descendants("root") select new { Name = item.Element("Child").Attribute("Name").Value, time = item.Element("Child").Attribute("time").Value };foreach (var item in items){ var lvi = activitiesList.Items.Add(item.Name); lvi.SubItems.Add(item.time);}
Here is my XML File
<root><Child Name="New Activity" time="20" /><Child Name="asdf1" time="5" /><Child Name="g1" time="0" /></root>
and my Listview should show this in two columns:
New Activity 20asdf1 5g1 0