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 6634051
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T22:53:05+00:00 2026-05-25T22:53:05+00:00

Im making a herbal database program and I am having troubles setting up HierarchicalDataTemplates

  • 0

Im making a herbal database program and I am having troubles setting up HierarchicalDataTemplates for my main data class.

Tree layout wanted:

  • Glossary
    • Category1
      • Letter (Reduces overall list size)
        • Entry
          • Note1
          • Note2
  • Herbs

    • Botanical Name

      • Alphabetical
        • Letter (Reduces overall list size)
          • Entry
      • By Family
        • Family
          • Entry
    • Common Name

      • Letter (Reduces overall list size)
        • Entry

NOTE: All entries have notes
NOTE2: Letter is a letter of the alphabet for sorting

Ex:

  • a
    • apple
  • b
    • bus

Main Class:

Public Class MainSystem
    Public herbs As New Dictionary(Of Integer, herbEntry)
    Public glossary As New Dictionary(Of Integer, glossaryEntry)
End Class

GlossaryEntry:

Public Class glossaryEntry
    Public Property ID As Integer
    Public Property Words As List(Of String) 'Each word is in the format: Catagory/word
    Public Property Notes As SortedDictionary(Of String, String)
End Class

HerbEntry:

Public Class herbEntry
    Public ID As Integer
    Public Property commonName As List(Of String)
    Public Property botanicalName As List(Of String)
    Public Property PlantID As PlantID
End Class

EDIT: Thanks to the link from @AngelWPF I have got the tree displaying my object. But, currently the tree looks like this:

  • Herbs
    • Common Name
      • CommonName item from entry
      • Another CommonName item from entry
    • Common Name
      • CommonName item from entry
      • Another CommonName item from entry

How can I make this change to match my hierarchy?

XAML:

<UserControl.Resources>
        <HierarchicalDataTemplate  DataType="{x:Type my:herbEntry}">
            <TreeViewItem Header="Common Name"  ItemsSource="{Binding commonName}">

            </TreeViewItem>
        </HierarchicalDataTemplate>
    </UserControl.Resources>
    <Grid>
        <TreeView HorizontalAlignment="Stretch" Name="TreeView1" VerticalAlignment="Stretch">
            <TreeViewItem Header="Herbs" ItemsSource="{Binding herbs.Values}"/>
        </TreeView>
    </Grid>
  • 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-05-25T22:53:06+00:00Added an answer on May 25, 2026 at 10:53 pm

    This example may guide you to assign different item templates at different levels for each type of bound item …

    Having HierarchicalDataTemplates in a TreeView

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

Sidebar

Related Questions

Making a very basic paint program for a class and one of the requirements
Making an adobe flex ui in which data that is calculated must use proprietary
Making a form that will accept a bunch of textual data and an image
Im making a modular program, and it supports dynamic compilation of source files in
making an Access database (2003) that is mainly used by other programmers and tech
Making a simple program which will generate a multiple choice form. I have an
Making a ruby on rails application for a class, and we are not allowed
Making an ajax call to return some data from the server. The data comes
Making a social media app. I have a main viewFlipper with several views therein.
Making this paintbrush program I decided I want to clear the panel container (

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.