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

RadTreeView Binding

1 Answer 83 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Edward
Top achievements
Rank 1
Edward asked on 21 Jul 2010, 08:13 PM
I have a usercontrol bound to a ViewModel containing a RadTreeView.  This is in a OutlookBarItem and displayed as a region in through a ContentControl. 

In another region bound to another ViewModel I have some configuration RadioButtons and selection of the one of the RadioButtons eventually calls a method "XYZ" in the first ViewModel. 

In the the "XYZ" method of the first ViewModel I set a dependency property which is an ObservableCollection<ABC> type.  My TreeView is bound to this dependency property.

When I first bring up the application I go get all my needed data and fill three ObservableCollections - each ObservableCollection had nested Children of ObsrvableCollections. Some two deep some four deep ...

I can get the RadTreeView to display the EntityTree dependency property that it is bound to initially.  But when I select an alternative radiobutton and set the dependencyproperty to the appropriate observable collection object, it does not refresh the RadTreeView on the view.   Do I have to do something to the region to get this refreshed?  Is the binding of the itemssource to this entitytree dependency property enough to get this radtreeview to refresh itself?  What's wrong?

-ed

1 Answer, 1 is accepted

Sort by
0
Hristo
Telerik team
answered on 23 Jul 2010, 04:40 PM
Hi Edward,

I'm attaching you an example that I hope will help you. SampleViewModel class extends ObservableCollection and is used to provide data to the treeview.
If your model is more complex you can nest the ObservableCollection as a member of the ViewModel class. Then your ViewModel class must implement the INotifyPropertyChanged interface and fire the PropertyChanged event when changes are made to the ObservableCollection member. I left several comments in the sampleViewModel.cs file highlighting the milestones that must be performed when using ObservableCollection as a member.

Kind regards,
Hristo
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
TreeView
Asked by
Edward
Top achievements
Rank 1
Answers by
Hristo
Telerik team
Share this question
or