Wpf treeview not updating
How to handle them may vary, depending on what you're doing and what you're looking to accomplish, but WPF comes with two very easy solutions that you can use: The Observable Collection and the INotify Property Changed interface.
The following example will show you why we need these two things: Try running it for yourself and watch how even though you add something to the list or change the name of one of the users, nothing in the UI is updated.
However, changes to the membership of the root member level Observable Collection Further explanation, long time for answer to come, but I believe that if you do the binding in XAML, and then in code assign a new object to the property you break the binding, so you would have to redo the binding in code for it to work.
The Name property represents the name of the control, which is a unique identifier of a control.
The Margin property tells the location of a Tree View on the parent control.
Please check the type of your tree List which you set as Data Context.
It has to be an Observable Collection to reflect your collection changes in the UI Or else for quick workaround, just set the Data Context again after you filled the List.
The example is pretty simple, with a User class that will keep the name of the user, a List Box to show them in and some buttons to manipulate both the list and its contents.