I have an issue with databinding a XML document to my WP8 app. The databinding part works (I think) but only displays the top element.
XML:
<Application>
<AppID>1</AppID>
<AppID>2</AppID>
<AppID>3</AppID>
<AppID>4</AppID>
</Application>
My current c# Code:
private void AddFromXML()
{
XDocument xdoc = XDocument.Load("Resources/20Sept.xml");
var data = from query in xdoc.Descendants("Application")
select new AppToDownload
{
AppID = query.Element("AppID").Value
};
applist.itemssource = data;
}
Where am I going wrong?
Do this way:-
var data = from query in xdoc.Descendants("AppID")
select new AppToDownload
{
AppID = query.Value
};
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.