LightSwitch TreeView DataContext Rebind???

2 posts, 1 answers
  1. VIHUCAR
    VIHUCAR avatar
    2 posts
    Member since:
    Jul 2012

    Posted 17 Jul 2013 Link to this post

    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.
  2. Answer
    Pavel R. Pavlov
    Admin
    Pavel R. Pavlov avatar
    1182 posts

    Posted 22 Jul 2013 Link to this post

    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 >>
  3. DevCraft banner
Back to Top