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

Building a multilevel hierarchy tree that is dynamic and not symmetric

1 Answer 73 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Jessica
Top achievements
Rank 2
Jessica asked on 16 Jan 2013, 04:18 AM

I do not even know where to start with this. I can build a tree that has parents and children, but I cannot figure out how to make it where it is not always symmetric. This is a validation tree so it tells the user error messages. For example, it should look like this:


    Object ID (Main Property)
    - Must start with a number (Description)
    Employee Name (Main Property)
          Employee 1 (SubProperty)
                - Cannot be blank (Description)
          Employee 2 (Subproperty)
                - Cannot be blank (Description)

Any help with this or something that would lead me in the right direction would be helpful. This is my first time working with trees in WPF/C# so please be kind haha.

1 Answer, 1 is accepted

Sort by
0
Tina Stancheva
Telerik team
answered on 18 Jan 2013, 02:27 PM
Hi Jessica,

I'm not sure if I understand correctly your requirements. But it seems to me that you'd like to build a RadTreeView where on one level you can have different business types displayed. If this is the case, you'll only need to make sure that you can create a collection of all root items and then use a custom DataTemplateSelector to apply a different DataTemplate for each data type.

I prepared a sample solution demonstrating this approach. Please note that I create a collection of objects whenever I need to make sure that different type of items will be added in that collection - in the sample solution this approach is used to declare the MainViewModel.Items collection as well as the Children collection in the Employee class.

I hope this project will get you started on your task. And if you have any further questions, please let us know.

Kind regards,
Tina Stancheva
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
TreeView
Asked by
Jessica
Top achievements
Rank 2
Answers by
Tina Stancheva
Telerik team
Share this question
or