Filter clears selection

Grids for WPF Forum

Posted 6 years ago by Mike
Version: 18.1.0670
Platform: .NET 4.7
Environment: Windows 10 (64-bit)
Avatar

Hi,

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)

Answer - Posted 6 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

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 6 years ago by Mike
Avatar

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

Posted 6 years ago by Darcy Davidson
Avatar

Hi,

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?

D'Arcy

Answer - Posted 6 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

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

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

Add Comment

Please log in to a validated account to post comments.