I have bound a TreeView to an XMLDataProvider. The TreeView displays the data as expected in the Visual Studio editor. But when I press F5, the application runs but the treeview is blank. Does anyone know why I can't see it when I run the application?
Here's the entire code:
<Window x:Class="TreeViewDataBinding.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Window1" Height="300" Width="300">
<Window.Resources>
<XmlDataProvider x:Key="FolderList">
<x:XData>
<TreeFolders>
<Folder Name="Audit Reports" />
<Folder Name="Joes Test" >
<Folder Name="Analysis01" />
<Folder Name="Test090803" />
</Folder>
<Folder Name="Carl" />
<Folder Name="Steve" />
</TreeFolders>
</x:XData>
</XmlDataProvider>
<HierarchicalDataTemplate
x:Key="FolderTreeItemTemplate"
DataType="Folder">
<HierarchicalDataTemplate.ItemsSource>
<Binding XPath="child::*" />
</HierarchicalDataTemplate.ItemsSource>
<TextBlock Text="{Binding XPath=@Name}" />
</HierarchicalDataTemplate>
</Window.Resources>
<Grid>
<TreeView
ItemsSource="{Binding Source={StaticResource FolderList}, XPath=//TreeFolders/*}"
ItemTemplate="{StaticResource FolderTreeItemTemplate}" />
</Grid>
</Window>