This is a migrated thread and some comments may be shown as answers.

Add Level Between Parent and Different Children Properties

1 Answer 24 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Kyle
Top achievements
Rank 1
Kyle asked on 21 Feb 2014, 09:04 PM
I am looking to add a hard coded or static level between a parent class and it's children properties.
I have a collection of Parent, and the parent class has 2 collection properties named Children 1 and Children 2.

class Parent {
 public IEnumerable<Child1>Children1 { get; set; }
 public IEnumerable<Child2>Children2 { get; set; }
}

I would like a tree to show the following:
Parent
>Children 1
>>Child1
>>Child1
>Children 2
>>Child2
>>Child2

I can't seem to figure out the correct combination of HierarchicalDataTemplate or DataTemplate to accomplish this. Can you point me in the right direction?

1 Answer, 1 is accepted

Sort by
0
Tina Stancheva
Telerik team
answered on 26 Feb 2014, 04:39 PM
Hello Kyle,

In order to implement this requirement you will need to use a converter when you bind the ItemsSource of the root-level HierarchicalDataTemplate. You will have to manually pass the proper collection of items to the next level and an IValueConverter is a good place to do that in code.

Unfortunately we don't have an example of this particular scenario but please let me know if you encounter any issues with its implementation and we will gladly assist you further. You can also take a look at this forum thread that describes a similar case.

Regards,
Tina Stancheva
Telerik
Tags
TreeView
Asked by
Kyle
Top achievements
Rank 1
Answers by
Tina Stancheva
Telerik team
Share this question
or