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

Binding Heterogeneous Data with RADTreeView

5 Answers 84 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Kshama Bafna
Top achievements
Rank 1
Kshama Bafna asked on 19 Nov 2009, 04:46 PM

Hi,

I am using RADTreeview and  I would like to bind the heterogeneous  data as the hierarchal structure. For e.g. I want to bind List<A> which has List<B> and List<C> as its children. 

Regards,
-Kshama

5 Answers, 1 is accepted

Sort by
0
Kiril Stanoev
Telerik team
answered on 23 Nov 2009, 12:24 PM
Hi Kshama,

Have you considered using HierarchicalDataTemplate when building the tree. I have created a sample project that mimics the functionality you have described. My data source consists of different types of items, and depending on the type of the item, I use DataTemplateSelector to pick the right template.
The link to using HierarchicalDataTemplate is for Silverlight, but its Wpf counterpart is almost the same.
The attached sample project contains Wpf and Silverlight version of your scenario. Have a look at it and if you have additional questions, let me know.

All the best,
Kiril Stanoev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Joel Palmer
Top achievements
Rank 2
answered on 31 Dec 2009, 04:57 PM
I have a hierarchy that doesn't play so nicely.  The S88 Hierarchy (http://en.wikipedia.org/wiki/ISA-88) is as follows:

System (S) --> Area (A) --> Process Cell --> (P) --> Unit (U) --> Module (M) --> HistoryDataPoint (H)

If life was this simple, however, I wouldn't be writing this question.  In this hierarchy, there is nothing from preventing an A --> M relationship and everything in between.  Basically, I have an object for each Type so... how do I assign the ItemsSource to multiple different object types?   

Other Combinations:

S --> A (System to Area is the only combination)

A --> P --> U --> M
A --> U --> M
A --> M

A --> P --> M
A --> U --> M

M --> H  (Module to History Data Point is the only combination)

Any help you can provide would be appreciated.
0
Valentin.Stoychev
Telerik team
answered on 04 Jan 2010, 09:15 AM
Hello Joel Palmer,

What is the exact problem you are facing with this scenario?

Regards,
Valentin.Stoychev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Joel Palmer
Top achievements
Rank 2
answered on 04 Jan 2010, 08:35 PM
Using Kshama's Example, I want to bind the <Area>Object ItemsSource to List<ProcessCell> and List<Unit> and List<Module>.  Which... after looking again, is possibly the answer you already provided.

I already accomplished this by creating a generic object structure as follows:

Item 
    - Name
    - ItemType
    - List<Item> Children
ItemType 
    - Name (S88 Type, eg Module)

However, this requires me to hydrate that structure from the source structure... I don't want that separation.  I need an example on how to bind multiple different object types as children. 

Does your "local:NodeTemplateSelector" act as the conduit for which the different types are bound to the one ItemsSource?
0
Kiril Stanoev
Telerik team
answered on 05 Jan 2010, 12:07 PM
Hi Joel,

Currently, using a generic item is the only solution I am aware of. However, if you find a more elegant way I'd be glad if you share it with me. As for your other question, the DataTemplateSelector determines which template will be applied to an item once it has been created. If this hasn't answered your questions, could you please elaborate a little bit more. I'd be glad to further assist you.

Kind regards,
Kiril Stanoev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
TreeView
Asked by
Kshama Bafna
Top achievements
Rank 1
Answers by
Kiril Stanoev
Telerik team
Joel Palmer
Top achievements
Rank 2
Valentin.Stoychev
Telerik team
Share this question
or