C# WPF数据网格过滤器。搜索单元格文本的一部分,而不是确切的内容

C# WPF数据网格过滤器。搜索单元格文本的一部分,而不是确切的内容,c#,wpf,datagrid,C#,Wpf,Datagrid,我有一个Datagrid和一个文本框,用户将在其中引入一个文本进行过滤,但现在只过滤相同的文本。我的意思是,如果行文本是“ABCDE”,并且用户在过滤器文本框中写入“ABCDE”,它就会出现。如果用户写入“ABCD”,则不会。我希望过滤器显示所有与“ABCD”匹配的内容,例如“XAGABCDA”或“ABCDEGFA”,而不是仅显示与“ABCD”完全匹配的内容 我有一个简单的代码: private static SqlConnection con = new SqlConnection("Data

我有一个Datagrid和一个文本框,用户将在其中引入一个文本进行过滤,但现在只过滤相同的文本。我的意思是,如果行文本是“ABCDE”,并且用户在过滤器文本框中写入“ABCDE”,它就会出现。如果用户写入“ABCD”,则不会。我希望过滤器显示所有与“ABCD”匹配的内容,例如“XAGABCDA”或“ABCDEGFA”,而不是仅显示与“ABCD”完全匹配的内容

我有一个简单的代码:

private static SqlConnection con = new SqlConnection("Data Source=10.***.0.***; User Id=sa;Password=***; Initial Catalog=***");
private static SqlCommand myCmdE = new SqlCommand("SELECT * FROM COMPAINES_EXT", con);
private static SqlDataAdapter daE = new SqlDataAdapter(myCmdE);
private static DataTable dtE = new DataTable("COMPAINES_EXT");
IBindingListView blvE = dtE.DefaultView;

public void Load() //this fills the DataGrid "dataGridE"
{
        daE.Fill(dtE);
        dataGridE.ItemsSource = dtE.DefaultView;
}             

private void btn_filtrarE_Click(object sender, RoutedEventArgs e)
{
        dataGridE.DataContext = dtE;
        blvE.Filter = cmb_FiltrarE.Text + " = '" + txt_filtrarE.Text + "'";
}

//this filters using the column names already written in the combobox cmb_FiltrarE and looks for the text written in the textbox txt_filtrarE
无论如何,
IBindingListView
允许我搜索字母或单词,而不是单元格的确切内容吗?我不想使用循环


也许有一种不同但有效的方法可以做到这一点,那也太好了。

如果我没记错的话,语法类似于t-sql:
blvE.Filter=cmb\u FiltrarE.Text+“像“%”+txt\u FiltrarE.Text+“%”可能重复的