Using more than one filter in CollectionViewSource
On my code i have itemsControl and i want to filter the items that are pressent.
SO, I define CollectionViewSource and i wrote this code :
CollectionViewSource view = new CollectionViewSource();
view.Source = myItemCollection;
view.Filter += ( s, e ) =>
{
e.Accepted = ( ( myItem )e.Item ).FilterFiels.Equals( stringFilter );
};
itemsControl.SetBinding( ItemsControl.ItemsSourceProperty, new Binding()
{
Source = vi开发者_开发百科ew
} );
Now, I want to use more than one filter in my code. That mean that i want to use filter stringFilter_1 and stringFilter_2
How can i do it ?
Just compound your filter expression with appropriate conditional operators (i.e. && and ||)
精彩评论