I have attached a very simple application that demonstrates the following situation:
- a node is added to the tree- the node is removed from the tree- a garbage collection is forced
Using the XamDataTree, the node is not garbage collected.Using the WPF TreeView it is garbage collected as expected.(I know this because a message box is triggered in the node's finalizer.)
Could you please look at the attached code and tell me what I have to do in order to have the removed node properly garbage collected.
Hello Matt,
thanks for your quick answer.
Please note that this is a very simple case to demonstrate the problem.In my real application I additionally have
- the CollapsedItemTemplate and the ExpandedItemTemplate properties both set to a DataTemplate that contains a Binding- the NodeStyle property set to a Style that contains Bindings- the ItemTemplate property set to a DataTemplate that contains Bindings- inside this DataTemplate is an element that has a context menu -- this context menu is also generated by a Binding
The Bindings are set like this (example for a very simple ItemTemplate):
<ig:XamDataTree ItemsSource="{Binding Path=DataContainer}"> <ig:XamDataTree.ItemTemplate> <DataTemplate> <TextBlock Text="{Binding Path=Data.Label}" /> </DataTemplate> </ig:XamDataTree.ItemTemplate></ig:XamDataTree>
So please make sure that nodes that have been removed from the ItemsSource can be garbage collected even under these more complicated circumstances.
HI Tjark,
I have replicated your issue. I will bring this issue to the attention of the developers.
I will create a private case for this issue and email you with the details
Sincerely, MattDeveloper Support Engineer