views:

823

answers:

1
+1  A: 

You need to define an xmlns mapping to your Page class in the XAML file and use that in your Type declaration. The reason why you aren't getting a compile error is that the Page class is already defined in WPF.

So, if your Page class was defined in the Zack namespace, in the TreeViewBinding assembly, you would need to add the following declaration to the parent container (most likely Window):

xmlns:local="clr-namespace:Zack;assembly=TreeViewBinding"

And then modify your DataTemplate to the following:

<HierarchicalDataTemplate DataType="{x:Type local:Page}" ItemsSource="{Binding Children}">

I will clarify my post for your original question.

Abe Heidebrecht
previous question: http://stackoverflow.com/questions/272854/wpf-treeview-binding
Zack Peterson