Preventing found node to expand when AutoExpandItemsOnFilter is true

Grids for WPF Forum

Posted 2 years ago by Alex
Version: 19.1.0687


I'm using the TreeListBox control in my application and I have question about the AutoExpandItemsOnFilter property and the usage of filtering. When AutoExpandItemsOnFilter is True, I noticed that the found nodes will automatically expand all of it's children recursively, on top of expanding ancester nodes to make the found node visible. However, our application can contain a lot of nested child elements in each nodes and we would like to prevent exposing the children to avoid polluting the view, and let the users expand the Child nodes they're interested to see.

To better visualize what l mean: using your TreeListBoxFiltering set the following:
IsFilterActive =  true
NameFilter = "Canada"
Operation = Contains
IncludedResuts = IncludedWithDescend
AutoExpandItemsOnFilter = true

If you collapse the Canada node to hide the provinces and play with the Name filter string by removing some characters, the Canada node keeps expanding to expose the provinces. However, we wish to keep nodes that were found collapsed, and only expand the ancester nodes leading to the found node. It's more obvious if you search for "North America" and see all child nodes expanded, included the nodes with children.

I re-read the documentation file and search in the Grids forum, but haven't found what I needed. I was thinking of a stategy of not using AutoExpandItemsOnFilter and instead do the expanding of it's parent nodes in the Filter method of my StringFilter, just before returning  IncludedWithDescendants on the found node. However, when AutoExpandItemsOnFilter is false, I lose the important feature of restoring the view pre-filtering, when IsFilterActive is set to false (which will be the case in my application when search box is cleared).

Can you advise on the best course of action?

Thank you very much,

Comments (2)

Posted 2 years ago by Actipro Software Support - Cleveland, OH, USA

Hi Alex,

Thanks for reporting this.  It required some code changes in our tree filtering logic to get it so that only items that truly were included by the filter will be fully expanded to.  We were able to squeeze this in prior to the incoming v22.1 release.

Actipro Software Support

Posted 2 years ago by Alex

Thank you for your fast answer! Good to hear it will be resolved in the next release.

The latest build of this product (v24.1.2) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.