views:

1048

answers:

2

My BindingSource is bound to a collection of objects (not using ADO.NET) and I would like to filter it and exclude some values but not sure if I'm using this exactly since the result set I am expecting is not coming back. I was thinking something like this, but its not working:

MyBindingSource.Filter = "State = 'NY' AND State = 'MA' AND State = 'CO'";

Any assistance will be greatly appreciated!

A: 

I never tried it outside of the WPF world, but you could take a look at the ListCollectionView (for IList)/BindingListCollectionView (for IBindingList). It should raise the necessary events, and you can use the filter without the underlying list.

Martin Moser
+2  A: 

You've used AND.

If you want your filter to work you want this:

MyBindingSource.Filter = "State = 'NY' OR State = 'MA' OR State = 'CO'";

There is no way that something in boolean can be in two states at the same time. (At least in logic realms I work in anyway...)

Spence