开发者

Using more than one filter in CollectionViewSource

开发者 https://www.devze.com 2023-03-14 04:06 出处:网络
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 :

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 ||)

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号