As I understand it, you want the top level nodes, and 1 level of children of those, and no further (so there will be 2 levels of nodes overall). Then you can do it with 2 templates if you want to do it in XAML:
<Grid>
<Grid.Resources>
<DataTemplate x:Key="TemplateLeaf">
<TextBlock Text="{Binding Text}" /> <!-- Whatever leaf view you want -->
</DataTemplate>
<sdk:HierarchicalDataTemplate ItemsSource="{Binding Items}" ItemTemplate="{StaticResource TemplateLeaf}" x:Key="TemplateNode">
<TextBlock Text="{Binding Text}" />
</sdk:HierarchicalDataTemplate>
</Grid.Resources>
<sdk:TreeView ItemsSource="{Binding Items}" ItemTemplate="{StaticResource TemplateNode}" />
</Grid>
(That's the Silverlight version but it's the same). By default the HierarchicalDataTemplate
uses itself as its own ItemTemplate
, but you can replace that with some other template for the next level (including a plain DataTemplate
) if you want.