I'm completely new at silverlight, and trying to do things "the right way".
Problem is: I have an XML that I need to get from a web server, and I need to display that data in a datagrid.
I've searched around and I've managed to get the following:
say my XML looks like:
<customers>
<customer>
<name>A Person</name>
<address>my address</address>
</customer>
<customer>
<name>A Guy</name>
<address>my address 2</address>
</customer>
</customers>
I can retrieve this and populate a POCO such as:
public class Customer
{
public string Name { get; set; }
public string Address { get; set; }
}
...
XDocument oDoc = //read from a string asnychronously
var myData = from info in oDoc.Descendants("customer")
select new Customer
{
Name = Convert.ToString(info.Element("name").Value),
Address = Convert.ToString(info.Element("address").Value
};
_grid.ItemsSource = myData;
However, if I take this approach, I won't really be using Silverlight's dynamic binding capabilities.
How can I do this in the "Silverlight" way so that when I (or someone else who actually knows silverlight) look at the code a few years down the line, don't hate absolutely hate what I've done.