Applying a filter clears SelectionMode and creates unexpected Selection Behaviour

Grids for WPF Forum

The latest build of this product (v22.1.4) was released 25 days ago, which was before this thread was created.
Posted 22 days ago by Molly
Version: 22.1.4
Avatar

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 :)

Comments (1)

Posted 21 days ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hello,

This is a bit of a tricky scenario so can you put together a new simple sample project that shows it happening and send that to our support address, referencing this thread?  Be sure to exclude the bin/obj folders from the .zip you send so it doesn't get spam blocked.  Then we can have a look and see what's going on.  Thanks!


Actipro Software Support

Add Comment

Please log in to a validated account to post comments.