Rebinding a TreeView

2 posts, 0 answers
  1. Mark Bostleman
    Mark Bostleman avatar
    2 posts
    Member since:
    Aug 2009

    Posted 30 Aug 2009 Link to this post

    I have a private instance of a collection of business objects on a form.  On form load, I fill the collection with data and bind it to a treeview.  In reaction to user input elsewhere on the form, I add and remove items from the collection.  At that point I need to refresh the binding of the TreeView.  I tried resetting the DataSource property and I've tried the Refresh and Update methods, but nothing I do makes the TreeView display the new data.

    How do I do this?
  2. Victor
    Victor avatar
    1349 posts

    Posted 31 Aug 2009 Link to this post

    Hi Mark,

    Thank you for writing.

    In order to be compliant with the data binding mechanism of RadTreeView you need to support the basic interfaces which are provided by the WinForms library, namely, the IBindingList and INotifyPropertyChanged interfaces. IBindingList is provided automatically by the BindingList class. The INotifyPropertyChanged interface must be implemented by your business objects so that RadTreeView can react on direct object changes.
    In short, your custom objects must implement INotifyPropertyChanged and your private collection must be of type BindingList or it must explicitly implement IBindingList.
    Please write again if you need further assistance.

    Sincerely yours,
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. DevCraft R3 2016 release webinar banner
Back to Top