I have a DataTree where I hide Nodes without children and also dynamically change the displayed "Control Content" for the nodes based on what their type is. I do this by using the NodeExpansionChanged event. The problem I'm having is that when I scroll so that some nodes leave the view and then scroll back, the control values get reset. So, the empty nodes that were hidden are now visible and all nodes show their original content.
I've attached a sample project. This issue can be replicated by keeping the window small then expanding all the nodes. Once you scroll down then scroll back up the node content will be reset.
Thank you for posting. The behavior you described is expected, when you scroll the tree through virtualization it really depends on whether or not container recycled, you cannot dynamically change the visual tree element ,you have to get it through the database.
Associate S/W Developer
So, is the only way to change the visual tree elements is through the datasource? That is contradictory to the answers in this forum thread that suggests that nodes can be hidden by changing the visibility in the code-behind.
Right, to update the tree content you have to do it through the data source.
The post you mentioned above is about hiding the treenode and Andrew explained it to do it through the 'MultiDataTrigger' which is not the same as updating the node content.
In his second update he explained it more clearly with a sample application which you can refer to if your requirement is to hide the node.