Treeview - header for child nodes

Mar 7, 2011 at 8:28 PM

Hi,

I'm using a treeview, and populating it's nodes by binding a property.

This property is a class object ("ArbolTest") that has an ObservableCollection ("Cursos") of objects from another class and an atribute (Nombre as a caption to be shown).

Each element inside the observableCollection has a List<> of elements ("Temas") where each one has a property (Nombre as a caption) as well.

 

The code I am already using is:

 

 

<sdk:TreeView Name="LBTree" ItemsSource="{Binding ArbolTest.Cursos,Mode=TwoWay}">

	<sdk:TreeView.ItemTemplate>

	<DataTemplate>

		<sdk:TreeViewItem cal:Message.Attach="Show($dataContext)" Header="{Binding Path=Nombre,Mode=TwoWay}" ItemsSource="{Binding Temas}">

		<DataTemplate>

			<sdk:TreeViewItem cal:Message.Attach="Show($dataContext)" Header="{Binding Path=Nombre}">

			</sdk:TreeViewItem>

		</DataTemplate>

		</sdk:TreeViewItem>

	</DataTemplate>

	</sdk:TreeView.ItemTemplate>

</sdk:TreeView>

And shows the parent nodes with their 'Nombre', but the child nodes are shown without their 'Nombre'...

What I am missing?