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

Update breadcrumb with treeview load on demand

2 Answers 121 Views
BreadCrumb
This is a migrated thread and some comments may be shown as answers.
Andreas
Top achievements
Rank 1
Andreas asked on 23 Nov 2012, 10:55 AM
Hey,

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 Answers, 1 is accepted

Sort by
0
Pavel R. Pavlov
Telerik team
answered on 28 Nov 2012, 10:46 AM
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.

0
Andreas
Top achievements
Rank 1
answered on 29 Nov 2012, 08:13 AM
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 ;)

Greetings
Tags
BreadCrumb
Asked by
Andreas
Top achievements
Rank 1
Answers by
Pavel R. Pavlov
Telerik team
Andreas
Top achievements
Rank 1
Share this question
or