Suppose I have a UserControl
whose DataContext
is set to an object that has an XmlDataProvider
property. I would like to bind to this property in my control's XAML, and specify some XPath. I tried this:
<TreeView ItemsSource="{Binding Path=PropertyName, XPath=/items/item/*}">
At runtime I get the exception "BindingExpression with XPath cannot bind to non-XML object". Removing the Path
property and setting the TreeView
's DataContext to the XmlPropertyName
directly works fine.
What gives? Are Path
and XPath
mutually exclusive?