Creating a tree is not an issue. It involves bit of work, but straight forward. You have to create a hierarchical data template from your list and get the tree populated. Following link has all the info.
Creating a wpf tree
OR if you don't want to use sdk
page resource:
tree in xaml:
<Grid TextElement.FontSize="10" DataContext="{StaticResource MyHierarchicalViewSource}" >
<GroupBox x:Name="gbTree">
<TreeView Name="HierarchyTreeview" HorizontalAlignment="Left" AllowDrop="True"
BorderThickness="0" VerticalAlignment="Top" Height="Auto"
ItemsSource="{Binding}">
<TreeView.ItemTemplate>
<HierarchicalDataTemplate ItemsSource="{Binding Itemchildren, Mode=TwoWay}">
<StackPanel Orientation="Horizontal" Margin="2">
<TextBlock x:Name="text" Text="{Binding Item.ItemLabel}" >
</TextBlock>
</StackPanel>
</HierarchicalDataTemplate>
</TreeView.ItemTemplate>
</TreeView>
</GroupBox>
</Grid>
code behing:
Me._HierarchyViewSource = CType(Me.Resources("MyHierarchicalViewSource"), System.Windows.Data.CollectionViewSource)
Me._HierarchyViewSource.Source = your hierarchical data collection
assuming your hierarchy class structure:
Item has
ItemChildren collection
However,I have the same issue in creating a specific context menu. I have posted my own question and haven't found a solution yet. I tried to do it with data triggers with no luck. The only way I know is creating a context menu for the whole tree and make it visible or invisible depending on item type.
If I find a workaround, I will post.