Building a multilevel hierarchy tree that is dynamic and not symmetric

2 posts, 0 answers
  1. Jessica
    Jessica avatar
    3 posts
    Member since:
    Jul 2012

    Posted 15 Jan 2013 Link to this post

    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.

  2. Tina Stancheva
    Tina Stancheva avatar
    3299 posts

    Posted 18 Jan 2013 Link to this post

    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.

Back to Top