0
votes

I have a WPF TreeView which varies in depth. My application also has the ability to search inside the tree. This is accomplished by using the Filter property of the ICollectionView interface. Searching and filtering all works fine, but the problem lies when I try to remove the filter.

I have the following scenario; I enter search criteria and the treeview is filtered and the result is shown. Now when I press my button to clear the filter, the filter is removed but the problem is that it shows only the child nodes of what I previously searched for and does not show the child nodes of the other nodes, these nodes are also not expandable anymore.

My search function recursively walks down the tree and tests each node for the entered search text.

Do I have to apply the view.Filter = null; statement for each node and their childnodes?

Thanks,

Grant

1

1 Answers

1
votes

Yes!

Every hierarchy level has it's own ICollectionView and each uses it's own filtering. So yes, yu have to clear the filter on every (parent-)node (depending on your exact implementation).