FilteredBindingList behavior

FilteredBindingList behavior

Old forum URL: forums.lhotka.net/forums/t/3900.aspx


pcanada posted on Thursday, November 15, 2007


I am using a FilteredBindingList that wraps an EditableRootListBase and I have a custom filter method which checks a date property of the business object for DateTime.MinValue (in effect, a blank date). So objects with a blank date should be INcluded in the filtered list, and when there is a date there, the item should be excluded from the list.

This all works great when first setting up the collections and binding it to a grid, however, after it is bound and the property that the filter is based on gets changed (a date is put in the property), shouldnt the item then be excluded from the filtered list? It currently does not do this because it seems that only a ListChangedType.Reset event would trigger FilteredBindingList to call its DoFilter() method again. When changing a property on a business object, only the ListChangedType.ItemChanged type is triggered.

In other words the FilteredBindingList doesnt provide 'active' filtering. You have to call ApplyFilter() again to explicitly force it.

Is this the intention? Was it designed like this for performance, so that each edit to a business object's property doesnt force a DoFilter() call?

RockfordLhotka replied on Thursday, November 15, 2007

This is intentional, and it was done for usability.

Consider the user experience of an in-place editing scenario where filtering is applied on any change. They edit a property, tab to the next cell (on the same row) and the row disappears.

I originally had it working this way, and it took me all of 10 seconds of testing to realize that this was totally unacceptable behavior for the end user. I was frustrated almost instantly Smile [:)]

pcanada replied on Thursday, November 15, 2007

haha, yeah i can imagine. im not using it for direct grid editing but certainly that would be unacceptable.

perhaps as an enhancement you could make an overload of ApplyFilter which takes no parameters and just re-executes DoFilter using the current/existing _filterBy and _filter values.

RockfordLhotka replied on Thursday, November 15, 2007

Yeah, that makes sense - added to the wish list.

Copyright (c) Marimer LLC