Binding Heterogeneous Data with RADTreeView

6 posts, 0 answers
  1. Kshama Bafna
    Kshama Bafna avatar
    1 posts
    Member since:
    Sep 2009

    Posted 19 Nov 2009 Link to this post

    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

  2. Kiril Stanoev
    Admin
    Kiril Stanoev avatar
    1511 posts

    Posted 23 Nov 2009 Link to this post

    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.
  3. UI for WPF is Visual Studio 2017 Ready
  4. Joel Palmer
    Joel Palmer avatar
    164 posts
    Member since:
    May 2009

    Posted 31 Dec 2009 Link to this post

    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.
  5. Valentin.Stoychev
    Admin
    Valentin.Stoychev avatar
    2198 posts

    Posted 04 Jan 2010 Link to this post

    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.
  6. Joel Palmer
    Joel Palmer avatar
    164 posts
    Member since:
    May 2009

    Posted 04 Jan 2010 Link to this post

    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?
  7. Kiril Stanoev
    Admin
    Kiril Stanoev avatar
    1511 posts

    Posted 05 Jan 2010 Link to this post

    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.
Back to Top
UI for WPF is Visual Studio 2017 Ready