I've been playing with XamlPad. I thought I'd embed some XML into the XAML to give me a fake set of hierarchical data. I'm not having much joy. This compiles, but doesn't show the items in the list. (Edit: The hierarchical aspect is for later. For now I just want to get stuff appearing in a list).
<Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:sys="clr-namespace:System;assembly=mscorlib" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" >
<Page.Resources>
<XmlDataProvider x:Key="MyXmlData" XPath="ParentNode">
<x:XData>
<MyDoc>Wee
<ParentNode>Hi</ParentNode>
<ParentNode>Low</ParentNode>
</MyDoc>
</x:XData>
</XmlDataProvider>
</Page.Resources>
<Border BorderBrush="Green" BorderThickness="5">
<Grid DataContext="{StaticResource MyXmlData}" ShowGridLines="True">
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="2*"/>
<RowDefinition Height="3*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<ListBox Grid.Row="1" Grid.Column="0" ItemsSource="{Binding}" Background="LightGray">
</ListBox>
</Grid>
</Border>
</Page>
If you remove the XPath="ParentNode" from the XmlDataProvider, it adds the entire document, verbatim, to the listbox. I'd prefer to have two nodes in the Listbox, one for each ParentNode.