filter binding source or bindinglist with textbox_

2019-07-08 16:49发布

I use winforms and c#.

How can I filter Binding source or binding list. with a textbox text ? I meam while I am typing in a textbox my grid is filtering with a %Like method not (=,equal)method.

thanks.

2条回答
地球回转人心会变
2楼-- · 2019-07-08 17:23

You may want to use CollectionViewSource class to enable filtering.

See here

查看更多
孤傲高冷的网名
3楼-- · 2019-07-08 17:31

I use delegate for this problem. Some code like bellow

        _List = _List.FindAll(
            delegate(MyEntity entity)
            {
                return entity.Title.Contains(TXT_Title.Text);
            }
        );
        Gview.DataSource = _List  ;
查看更多
登录 后发表回答