Update breadcrumb with treeview load on demand

3 posts, 0 answers
  1. Andreas
    Andreas avatar
    8 posts
    Member since:
    Nov 2012

    Posted 23 Nov 2012 Link to this post


    Ive got a syncronized breadcrumb and treeview.
    The only problem i got is the fact that a node in my treeview on a certain level (which is unknown) has IsLoadOnDemand enabled.

    So my question is:
    How do i update the current item in the breadcrumb to display its children, or even select those.

    For more information about my setup:
    I am using a webservice to retrieve a list of hierarchical data items. This result is currently attached to the treeview ItemsSource directly (which will may be moved to a more specific application context list, but doesnt matter here). On the same step the ItemsSource of the breadcrumb will be bound to the same list.

    Every node in my tree has an attribute which determines if this node has children. This only indicates if the webservice can give me more information about the children even if the current node object doesn't have children. This is done to keep the loading time/data transport low.

    Now if i navigate in the tree, the breadcrumb gets updated due to the current selection in the tree until i get to a node which has IsLoadOnDemand enabled. The node updates itself, but the breadcrumb will stay on the old "object" without childs. If i inspect the items directly, it has children. It looks like the RadBreadCrumbItem not does not update if its Item gets changed. (Little side note here: I have the INotifyPropertyChanged interface implemented on my node to notify if any attribute gets changed.)
  2. Pavel R. Pavlov
    Pavel R. Pavlov avatar
    1165 posts

    Posted 28 Nov 2012 Link to this post

    Hello Andreas,

    Such an issue may appear of the different levels in your data hierarchy have differently named collection of children. Then the Breadcrumb control will need an ItemTemplateSelector class to apply different templates on the different levels of the hierarchy.

    We prepared a sample solution demonstrating how to use a hierarchy of different data objects and display it in a RadTreeView using LoadOnDemand. The Breadcrumb control in the sample solution displays the same collection as the RadTreeView and on our side, as soon as an item loads its children on demand, the RadBreadcrumb control data is updated accordingly.

    Please try the solution on your side and let us know if it works for you or if we've missed something.

    All the best,
    Pavel R. Pavlov
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. DevCraft R3 2016 release webinar banner
  4. Andreas
    Andreas avatar
    8 posts
    Member since:
    Nov 2012

    Posted 29 Nov 2012 Link to this post

    Hey Pavel,

    thanks for the reply.
    I have solved the issue. Every possible element which will be displayed using RadTreeView have implemented a special ITreeNode interace, which defines a Children property. Besides that i simply have implemented the INotifyPropetyChanged interface on the data object itself to notify that the Children property has changed.

    Using this, the breadcrumb simply updates after using a LoadOnDemand TreeView.
    But thanks for the source using ItemTemplateSelector this will be usefull later on ;)

Back to Top