RowFilter hides reuslts after nothing he can find wpf

120 views Asked by At

I have DataGrid and TextBox for searching

 private void TextBox_TextChanged(object sender, TextChangedEventArgs e)
        {
                DataView dvs = (DataView)apps.DataContext;                    
                TextBox tb = (TextBox)sender;
                dvs.RowFilter = "Name like '*" + tb.Text + "*'";              
        }

It works perfectly when there is matches in dataGrid. For example, I write wo - he finds "Microsoft WOrd". Then I can add n and there is nothing like this (like won ). Okay, I press Backspace button and come back to searching wo and there is nothing in results... And even when I delete the whole string in textBox I'll never see a string in my datagrid (and in dataview). I've tried to use RowStateFilter but nothing changed.

In the other cases deleting letters works good (when my searching word didn't lead to "nothing found"). if I enter wor (he finds Word). If I delete last r - it finds everything like %wo%. It works Ok.

Do you have any ideas?

0

There are 0 answers