Wpf treeview observablecollection not updating


07-Apr-2020 19:03

My Tree View is bound to an Observable Collection and uses Hierarchical Data Templates. Only when users click a node in tree, a web service call will be sent to get its child items.My App has a Tab Control, Tree View is on one tabpage, the other tabpage has a datagrid, it has some data selected from treeview.Here's the simple example class: The converter implements a dictionary to keep track of all Folders that are allready a Tree View Folder and is able to convert one Folder or a Observable Collection into Tree View Folder or Observable Collection. The issue here is, that in the second Tree View the Text Block displays a Count=1 after the 3 seconds at entry "2." but no [ ] appears in the Tree View. The main issue here is, that one Folder only exists one time for the whole application whereat the corresponding Tree View Folder exists n times with different properties... But I must use the converter as I need Tree View Folder instances in all levels of the Tree View.As a matter of fact if you just delete the ", Converter=" in the Item Source binding everything works - I'm aware of that. It seems that the problem here is that WPF can not convert a Observable Collection into a Observable Collection.

It doesn't show up in the Tree View itself, but that's fine.Pseduo code that can be greatly improved with refactoring but gives the essence of the answer: I am affraid you will have to explicity call the notification on the parent Observable Collection container for each individual's parent ('Team').Then from the individual parent, set notification event for grand parent ('Department').If I create a observable Node Collection and use that as the root, it doesn't make any difference.