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

LightSwitch TreeView DataContext Rebind???

1 Answer 70 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
VIHUCAR
Top achievements
Rank 2
VIHUCAR asked on 17 Jul 2013, 03:27 PM
Hi there,

I'm trying with no success at all to rebind treeview datacontext. This is because after a user action on certain LightSwitch screen, in another screen (that holds the telerik silverlight treeview) a specific child node must be selected. Problem is, the first action adds a item to db that correspond to this new item in treeview that must be selected. So, treewiev datacontext doesn't include this new entity, it cannot resolve howto select it and expand it.

How can I achieve this? Rebind to a DataItemCollection is not possible, datacontext of treeview's in lightswitch app is of type ContainerFromItemGenerator.

Help will be greatly appreciated,

cheers.

1 Answer, 1 is accepted

Sort by
0
Accepted
Pavel R. Pavlov
Telerik team
answered on 22 Jul 2013, 11:48 AM
Hello,

In order to notify the UI that there is a new item in the database, your ItemsSource collection must implement the INotifyCollectionChanged interface. When you implement this interface the UI (the RadTreeView) will be automatically updated when you add an Item from code (e.g. another screen).

Please note that the ObservableCollection<T> implements this interface and you can get advantage of it. I hope this information will help you. Don't hesitate to ask if you have any other questions.

Regards,
Pavel R. Pavlov
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Tags
TreeView
Asked by
VIHUCAR
Top achievements
Rank 2
Answers by
Pavel R. Pavlov
Telerik team
Share this question
or