Filter clears selection

Posted 7 months ago by Avatar Mike


I'm using a simple string filter on TreeListBox which is bound to a textbox. On filtering items the selected item property of the TreeListBox changes. Is there a way to keep the selected item until its changed by the user only? I've been looking for something like a "FilteringStarted" and "FilteringEnded" event so I can save/restore the selection.

Comments (4)

Posted 7 months ago by Actipro Software Support - Cleveland, OH, USA

Hi Mike,

If you look at the IDataFilter in the TreeListBox's DataFilter property that you set, that has a FilterChanged event that fires.  That event fires whenever the filter enabled state changes, or one of the properties on the filter changes that could trigger a filter.  Perhaps you could look at that and see if your filter's properties have been updated in a way to know when filtering has started/stopped?

Actipro Software Support
Posted 7 months ago by Mike

Thanks, it is not perfect but I was able to find a workaround using your suggestion.

Posted 6 months ago by Darcy Davidson


I noted this behavior as well and also found a non-perfect work around.  In my case it was clearing a multiselection.  Maybe something for a future release?


Posted 6 months ago by Actipro Software Support - Cleveland, OH, USA

This situation is tricky because there isn't a real true start/end of the filter.  The filtering mechanism is a basic interface.  Some filters are string-based, while others might run a code-based predicate over values.  In Mike's scenario, he's pretty much always got the filter on.  It's just that with an empty TextBox value, the filter is allowing everything through.  However he could just as easily have a delegate filter with complex code that we wouldn't know if it was filtering anything or not.  That's the main we can't really have a set of FilterStarted/FilterEnded events with the way you're thinking of them. 

We could have those events based on the IsFilterActive property value changing, but that wouldn't help in this scenario since the filter is always active.

Actipro Software Support
Information The latest build of this product (2018.1 build 0674) was released 3 days ago, which was after the last post in this thread.

Add a Comment

Please log in to a validated account to post comments.