Setting ObservableCollection as data source for RadTreeView for WinForms

2 posts, 0 answers
  1. asd
    asd avatar
    1 posts
    Member since:
    Jan 2016

    Posted 11 Jan Link to this post

    Hi,

     I'm trying to migrate an app that was written in WPF using default tree view to Telerik UI WinForms RadTreeView. For the default tree that has been used previously I had an ObservableCollection to which I could add items and the change would be displayed in the TreeView immediately without me triggering any update method. However, with the Telerik's solution, when I set the DataSource to the observable collection, no change is visible even though that observable collection has been modified.

    The final result that needs to be achieved is to be able to display folder structure on a disc. Now obviously, I don't want to load a folder and all of its subfolders at once, but rather only load the content when the user decides to open the given folder.

    Can this be achieved using ObservableCollection and without the need of triggering some sort of update method?

    Thanks

  2. Hristo
    Admin
    Hristo avatar
    716 posts

    Posted 14 Jan Link to this post

    Hi,

    Thank you for writing.

    Data binding in Windows Forms behaves differently compared to WPF. Please refer to the following MSDN resources:
    I am sending you an example of a RadTreeView bound to a BindingList collection of models implementing the INotifyPropertyChanged interface. Another example is also available in our documentation: Load On Demand with CRUD operations.

    I hope this helps. Should you have further questions please do not hesitate to write back.

    Regards,
    Hristo Merdjanov
    Telerik
    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 Feedback Portal and vote to affect the priority of the items
  3. UI for WinForms is Visual Studio 2017 Ready
Back to Top