tags:

views:

29

answers:

1

I have a variable of XDocument, and I want to display its structure in a TreeView. I tried

TreeView1.DataSource = doc;

but I got this error

HierarchicalDataBoundControl only accepts data sources that implement IHierarchicalDataSource or IHierarchicalEnumerable.

A: 

Use XmlDataSource as data source.

BlueCode
You mean use XmlDateSource instead of XDocument?
Ahmad Farid
Create an XmlDataSource (you can find samples on MSDN) and bind it to your TreeView. XmlDataSource implements IHierarchicalDataSource.
BlueCode