I want to programmatically bind an XML file containing some results pulled out from database to my Datagrid. My XML looks like:
I suppose you already have xmldataprovider with your Xml source named myXMLDoc. then you can bind xml data to your WPF controls.
ItemsSource="{Binding Source={StaticResource myXMLDoc}, XPath=row}}" //bind "row" elements to your control
Is this what you're looking for?
http://joshsmithonwpf.wordpress.com/2007/06/04/binding-to-xml/
I think what you want to do is hook up ItemsSource to an XmlDataProvider
(which you can also create in code), with its XPath
set to /root/resultset/data/row
. Then for each element you can use, say Text = {Binding XPath=./field}
.
I'm a little iffy on the details since I haven't done this in a while, but hopefully that'll set you in the right direction.