views:

662

answers:

0

I have a WPF TreeView control that is binding to an XMLDataProvider. The nodes are appearing fine within the Treeview control however the following error is appearing:

System.Windows.Data Error: 43 : BindingExpression with XPath cannot bind to non-XML object.; XPath='Text/*' BindingExpression:Path=; DataItem='XmlDataCollection' (HashCode=6250253); target element is 'TreeViewItem' (Name=''); target property is 'ItemsSource' (type 'IEnumerable') XmlDataCollection:'MS.Internal.Data.XmlDataCollection'

I would like to resolve this error that is appearing in the VS.NET 2008 Immediate Window. The error occurs when I setup the DataProvider using code below:

Dim DataProvider As XmlDataProvider = CType(Me.FindResource("TreeviewXmlDataProvider"), XmlDataProvider)
Dim XmlPath As String = "TreeView.xml" 
ResponsesXmlDataProvider.Source = New Uri(XmlPath)

Any idea why this error would be appearing? The TreeView control is displaying the XML nodes correctly.