简体   繁体   English

使用textbox_keypress过滤绑定源或绑定列表

[英]filter binding source or bindinglist with textbox_keypress

I use winforms and c#. 我使用winforms和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. 我在输入文本框时感到麻木,我的网格正在使用%Like方法而不是(=,equal)方法进行过滤。

thanks. 谢谢。

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  ;

You may want to use CollectionViewSource class to enable filtering. 您可能要使用CollectionViewSource类来启用过滤。

See here 看这里

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM