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

  • SEARCH
  • Home
  • 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 7902757
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T09:35:09+00:00 2026-06-03T09:35:09+00:00

I’m a newbie to Visual Studio (2010) and Expression Studio (4). I have been

  • 0

I’m a newbie to Visual Studio (2010) and Expression Studio (4).

I have been trying to get a TreeView to connect to a .mdb database that I have connected in Visual Studio (using Silverlight Business Application) to show a Navigation Tree for the Name Properties in each table. I have 2 levels of hierarchy:

(there are many more properties than shown but these are the only required)

  1. Root Level: Location Table [LocationName Property]
  2. First Level: Area Table [AreaName Property] [LocationID]
  3. Second Level: Inspection Table [InspectionName Property] [AreaID]

I have tried many ways to connect and none seem to work – I am quite happy now with making a TreeView template with a connection to hierarchical Sample Data created in Expression Blend. Unfortunately, I can only seem to make a connection with the top level of my real database – so it only shows the names of the locations and won’t expand any further.

I have no idea what to do. The code I’m using is: (no code-behind)

Home.xaml

 <riaControls:DomainDataSource AutoLoad="True" d:DesignData="{d:DesignInstance my1:Location, CreateList=true}" Height="0" LoadedData="locationDomainDataSource_LoadedData_1" Name="locationDomainDataSource" QueryName="GetLocationsQuery" Width="0">
     <riaControls:DomainDataSource.DomainContext>
          <my:InspectDomainContext />
     </riaControls:DomainDataSource.DomainContext>
 </riaControls:DomainDataSource>

 <sdk:TreeView Height="200" ItemsSource="{Binding ElementName=locationDomainDataSource, Path=Data}" Name="locationTreeView1" Width="200" >
      <sdk:TreeView.Resources>
           <ResourceDictionary>
                <ResourceDictionary.MergedDictionaries>
                     <ResourceDictionary Source="NavigationTreeResourceDictionary.xaml"/>
                </ResourceDictionary.MergedDictionaries>
            </ResourceDictionary>
       </sdk:TreeView.Resources>
       <sdk:TreeView.ItemTemplate>
            <StaticResource ResourceKey="RootLevel"/>
       </sdk:TreeView.ItemTemplate>
   </sdk:TreeView>

Navigation Tree Resource Dictionary

 <common:HierarchicalDataTemplate x:Key="Level2">
     <StackPanel Orientation="Horizontal">
         <TextBlock Margin="5,0,3,0" 
               FontStyle="Italic" 
               Text="{Binding Path=Name}" />                    

     </StackPanel>
 </common:HierarchicalDataTemplate>

 <common:HierarchicalDataTemplate x:Key="Level1"                 
    ItemsSource="{Binding Path=Inspections}"
    ItemTemplate="{StaticResource Level2}">
     <StackPanel Orientation="Horizontal">
         <TextBlock Margin="5,0,3,0" 
               Text="{Binding Path=Name}" />

     </StackPanel>
 </common:HierarchicalDataTemplate> 

 <common:HierarchicalDataTemplate x:Key="RootLevel"
     ItemsSource="{Binding Path=Areas}"
     ItemTemplate="{StaticResource Level1}">
     <StackPanel Orientation="Horizontal">
         <TextBlock Margin="5,0,3,0"
               Text="{Binding Path=Name}" 
               FontWeight="Bold" FontSize="12" />
     </StackPanel>
 </common:HierarchicalDataTemplate>

Domain Service (c#) GetLocationsQuery

 public IQueryable<Location> GetLocations()
    {
        return this.ObjectContext.Locations.OrderBy(l=>l.Name);
    }

Is it perhaps something to do with the Query used? Should I be putting the information I need for the treeview in the GetLocationsQuery?

  • If so how do I put in the query to return a list of location names, child area names and child inspection names?

Thank you in advance.

  • 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-03T09:35:10+00:00Added an answer on June 3, 2026 at 9:35 am

    Have found a solution, I will post for others in the case it is needed:

    It was the domain service and metadata info that needed to be changed =>

    In the metadata file, each EntityCollection in a table that you want the service to pass back needs [Include] e.g.:

    Locations Table

    [Include]
    public EntityCollection<Area> Areas { get; set; }
    

    Areas Table

    [Include]
    public EntityCollection<Inspection> Inspections { get; set; }
    

    Inspections Table

    [Include]
    public EntityCollection<InspectionItem> InspectionItems { get; set; }
    

    and in the domain service file the query used requires:

    public IQueryable<Location> GetLocationsAndSubCategories()
        {
            return this.ObjectContext.Locations.Include("Areas.Inspections");
        }
    

    where each “.Entity” is the name of the collection entities that have been included in the metadata file.

    Back to the xaml – it should work with the code as long as the Binding path names are the same as the EntityCollection Names.

    🙂 Hope that has been useful

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

Sidebar

Related Questions

I have a jquery bug and I've been looking for hours now, I can't
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have a reasonable size flat file database of text documents mostly saved in
I'm trying to create an if statement in PHP that prevents a single post
I am trying to loop through a bunch of documents I have to put
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and

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.