I have a DB that looks like:
Locations [rootlevel]
Inspections [level1]
Areas [level1]
Inspections [level2]
So each Location can have zero or more Inspections and zero or more Areas, and Areas have zero or more Inspections. The records for Inspections all have a LocationID!=null and the AreaID=null or !=null to get this hierarchy.
I would like to get all the names of each item in the table in a treeview as navigation. So far I can get EITHER
Locations-->Areas-->Inspections OR
Locations-->Inspections
I cannot seem to get the treeview hierarchy to show what I need. Is it possible? I have tried to use a nested treeview as an item in the hierarchy to show what I want but it doesn't work correctly.
xaml code for Locations-->Areas-->Inspections
<!--NAVIGATION TREE HIERARCHICAL TEMPLATE-->
<common:HierarchicalDataTemplate x:Key="AssetManager" ItemsSource="{Binding Path=Areas}">
<!--START OF AREA OPTIONS TEMPLATE-->
<common:HierarchicalDataTemplate.ItemTemplate>
<common:HierarchicalDataTemplate ItemsSource="{Binding Path=Inspections}">
<!--START OF INSPECTION OPTIONS TEMPLATE-->
<common:HierarchicalDataTemplate.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<Image Source="Assets/Resources/ImageResources/SearchICON2.png" Height="20" Width="20" />
<TextBlock Margin="0,0,0,0" Text="{Binding Path=Name}"/>
</StackPanel>
</DataTemplate>
</common:HierarchicalDataTemplate.ItemTemplate>
<!--END OF INSPECTION OPTIONS TEMPLATE-->
<StackPanel Orientation="Horizontal">
<Image Source="Assets/Resources/ImageResources/ManufacturingICON.png" Width="20" Height="20"/>
<TextBlock Margin="0,0,0,0" Text="{Binding Path=Name}"/>
</StackPanel>
</common:HierarchicalDataTemplate>
</common:HierarchicalDataTemplate.ItemTemplate>
<!--END OF AREA OPTIONS TEMPLATE-->
<StackPanel Orientation="Horizontal">
<Image Source="Assets/Resources/ImageResources/ManufacturingICON.png" Width="20" Height="20"/>
<TextBlock Margin="0,0,0,0" Text="{Binding Path=Name}"/>
</StackPanel>
</common:HierarchicalDataTemplate>
<!--END OF NAVIGATION TEMPLATE-->
xaml for Locations-->Inspections
<!--NAVIGATION TREE HIERARCHICAL TEMPLATE-->
<common:HierarchicalDataTemplate x:Key="AssetManager" ItemsSource="{Binding Path=Inspections}">
<StackPanel Orientation="Horizontal">
<Image Source="Assets/Resources/ImageResources/ManufacturingICON.png" Width="20" Height="20"/>
<TextBlock Margin="0,0,0,0" Text="{Binding Path=Name}"/>
</StackPanel>
</common:HierarchicalDataTemplate>
</common:HierarchicalDataTemplate.ItemTemplate>
<!--END OF TEMPLATE-->
xaml for nested treeview
<!--NAVIGATION TREE HIERARCHICAL TEMPLATE-->
<common:HierarchicalDataTemplate x:Key="AssetManager" ItemsSource="{Binding Path=Areas}">
<!--START OF AREA OPTIONS TEMPLATE-->
<common:HierarchicalDataTemplate.ItemTemplate>
<common:HierarchicalDataTemplate ItemsSource="{Binding Path=Inspections}">
<!--START OF INSPECTION OPTIONS TEMPLATE-->
<common:HierarchicalDataTemplate.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<Image Source="Assets/Resources/ImageResources/SearchICON2.png" Height="20" Width="20" />
<TextBlock Margin="0,0,0,0" Text="{Binding Path=Name}"/>
</StackPanel>
</DataTemplate>
</common:HierarchicalDataTemplate.ItemTemplate>
<!--END OF INSPECTION OPTIONS TEMPLATE-->
<StackPanel Orientation="Horizontal">
<Image Source="Assets/Resources/ImageResources/ManufacturingICON.png" Width="20" Height="20"/>
<TextBlock Margin="0,0,0,0" Text="{Binding Path=Name}"/>
</StackPanel>
</common:HierarchicalDataTemplate>
</common:HierarchicalDataTemplate.ItemTemplate>
<!--END OF AREA OPTIONS TEMPLATE-->
<StackPanel Orientation="Vertical">
<StackPanel Orientation="Horizontal">
<Image Source="Assets/Resources/ImageResources/ManufacturingICON.png" Width="20" Height="20"/>
<TextBlock Margin="0,0,0,0" Text="{Binding Path=Name}"/>
</StackPanel>
<sdk:TreeView HorizontalAlignment="Left" ItemsSource="{Binding Source={StaticResource locationInspectionsViewSource}}" Name="inspectionsTreeView" VerticalAlignment="Top" ItemTemplate="{StaticResource Level2}" BorderBrush="{x:Null}" Background="{x:Null}"/>
</StackPanel>
</common:HierarchicalDataTemplate>
<!--END OF NAVIGATION TEMPLATE-->
Thank you