Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7971269
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T07:35:56+00:00 2026-06-04T07:35:56+00:00

I have a DB that looks like: Locations [rootlevel] Inspections [level1] Areas [level1] Inspections

  • 0

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

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T07:35:58+00:00Added an answer on June 4, 2026 at 7:35 am

    After much research, hair-pulling and head-desking I found that:

    No, it is not possible when using HierarchicalDataTemplate to display a nested TreeView hierarchy. The data template allows only for one ‘child’ per node.

    One solution is to merge the two list items ‘children’ into one list ‘child’ and use that within the hierarchy.
    So in my case the Locations will relate to a single ‘child’ table where Areas and Inspections entities are adjacent, with each Area relating to the relevant Inspection children and the Inspections have no children.

    A second solution is to use a nested DataGrid. This seems like cheating but it achieved the desired effect. The templates will need to be changed for the DataGrid so that there are have no column headers/alternate row colouring/higlighting etc. Depending on what the TreeView needs to look like.

    The second is, in fact, the easier option as it uses the standard DomainDataSource for the root table (with all inclusions) which allows for easy encapsulation of DataContext, it also means there is still no code-behind to ensure the layout is separate.

    There may be more ways, but I have found a solution that works for me and is easy.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a model that looks like this: Performance - Location - Event -
So I have a JSONObject (or String..) that looks like this: {locations:[{GeocodeResponse:{result:{formatted_address:Tchibanga (TCH), Gabon,address_component:[{long_name:Tchibanga,type:
I have some data in MongoDB that looks like this: { name: Steve, location:
I have JSON Object that looks something like the below object, this object can
I have html that looks like this with several items <div class=item> <p class=price>$388.00</p>
I have code that looks like this: obj.foo(); // obj might, or might not
I have class that looks like this: class A { public: class variables_map vm
I have code that looks like this: template<class T> class list { public: class
I have something that looks like the following: var someList = MockRepository.GenerateStub<IList<ISomething>>(); someList.Add(MockRepository.GenerateStub<ISomething>()); The
I have something that looks like the following: [CoolnessFactor] interface IThing {} class Tester

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.