I am aware that filtering clears the selected items of a TreeListView as it has been discussed on the forum before, however I am seeing a behavior where, when I apply filtering to one of my TreeLists, all the trees in the view lose their SelectionMode properties and generally fail to function as expected.
I have set up 3 trees, each having one column, we can call them trees A, B and C. When an item is selected in tree A, tree B is populated with A.SelectedItem.Children, similarly tree C is populated by B.SelectedItem.Children. I have it so that these trees update correctly on selection change and when I select an item in tree C (for example) the selected items in trees A and B are unaffected.
When I apply a filter to column A any given selection in tree A is cleared, this is fine as we can now select from tree A to populate tree B again. However, now if an item in tree B is selected, the selection in tree A is cleared, and if we select an item in tree C the selection in tree B is cleared. Before we applied the filter the SelectionModes of tree B and C were both "extended" but after filtering all three trees can only seem to have one selectedItem between the three of them and Shift and Ctrl Click no longer work to select multiple items. Even once the IsFilterActive property of tree A is set to false, the selection behaviour remains incorrect.
To populate the trees I am creating a new root node and adding children similar to this:
OnTreeAItemSelected(object obj)
{
TreeNodeModel selectedItem = obj as TreeNodeModel;
TreeRootB = new TreeNodeModel();
foreach (TreeNodeModel child in selectedItem.Children)
{
TreeRootB.Children.Add(child);
}
}
Where TreeRootB is the binding source for Tree B's items. I suspect maybe some references to the original TreeA are kept when I do this soft copy and some are lost which results in the erratic behaviour but if that is the case I am still unclear as to why the SelectionMode of the trees should change as they are set in the XAML and not touched.
How can I filter items while keeping the original selection behaviour I want?
Any help would be appreciated! Thank you :)