We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback
Platform : WPF
|
Category : TreeView

I have a custom type called Group which has 2 collections Products and Services and I want both these collections to appear as siblings when the Groups collection is bound to a tree, how do I do that?

Let us say you want have a hierarchical list like this: And the underlying Group type defined like this: Then you will have trouble binding this to a TreeView to get the above indicated effect. To achieve the above effect, you should first implement a dummy "Children" collection that is a combination of the Products and Services collection as follows: Then create a HierarchicalDataTemplate for the Group object as follows: This will render both the Products and Services list as siblings at the same level.

You should also declare HierarchicalDataTemplates for the Product and Service types you might have defined.

You would of course, bind the tree to a collection of Group items.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon