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

UI/Tree Node doesn't update on TreeListView

2 Answers 127 Views
TreeListView
This is a migrated thread and some comments may be shown as answers.
Rocky
Top achievements
Rank 1
Rocky asked on 10 Apr 2013, 09:05 AM
Hi all,

I have an application which is using RadTreeListView to bind and display as a tree. The ItemSource is binded from ViewModel with type is RadObservableCollection and declared:

ItemsSource="{Binding HistoryList, Mode=TwoWay,
UpdateSourceTrigger=PropertyChanged,
NotifyOnSourceUpdated=True,
NotifyOnTargetUpdated=True}"

The issue is when I add a new node to HistoryList then call RaisePropertyChange of HistoryList, the UI of RadTreeListView doesn't update even though the data added.

this.HistoryList.Add(treeViewItem);
this.RaisePropertyChanged(x => x.HistoryList);

Then if I use reset() method of RadObservableCollection, the UI is updated but float top the top of view. So the question is how can I handle with it? I mean I wan to keep the state/position of node that I selected.. not jump or float.

This video gets better for you to understand: http://screencast.com/t/iLa3XWsa

Thank you

2 Answers, 1 is accepted

Sort by
0
Rocky
Top achievements
Rank 1
answered on 12 Apr 2013, 03:21 AM
Can someone help me please?
0
Maya
Telerik team
answered on 17 Apr 2013, 06:54 AM
Hi Rocky,

Generally, if you are working with observable collection, you do not need to call property changed since the collection will be aware of add/remove changes. You can verify that by handling CollectionChanged event and check whether it is called on adding the new item.
Considering scrolling to the top on resetting the collection, it will be the expected behavior. What you can try is either to save the position of the scroll viewer (through its offset properties) or call ScrollIntoView method of the tree list view. 

Greetings,
Maya
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
TreeListView
Asked by
Rocky
Top achievements
Rank 1
Answers by
Rocky
Top achievements
Rank 1
Maya
Telerik team
Share this question
or