I have a WP7 which read a XML file, take some elements and bind them to a listbox
Here is the code:
XDocument data = XDocument.Load("file.xml");
var persons = from query in data.Descendants("Table")
select new Person
{
Phone = (string)query.Element("Phone"),
Name= (string)query.Element("Name"),
};
listBox1.ItemsSource = persons;
public class Person
{
string Phone;
string Name;
public string Phone
{
get { return phone; }
set { phone = value; }
}
public string ame
{
get { return name; }
set { name = value; }
Now i want to do the same but the XML file is on a URL.
Can someone help me?
Thank you
You should use
WebClientclass to get the content from URL and then parse it toXDocumentobject:You can try something like that:
and the HttpCompeted: