Filter DataGrid for name with TextBox dynamically

后端 未结 1 805
有刺的猬
有刺的猬 2020-12-04 01:12

First to my problem: Id like to filter my DataGrid with a TextBox dynamically for the Name.

My current code:

how the

1条回答
  •  一整个雨季
    2020-12-04 01:25

    Change your code to this:

    private void TextBox_TextChanged(object sender, EventArgs e)
    {
        DataView dv = ds.Tables[0].DefaultView;
        dv.RowFilter = string.Format("Name like '%{0}%'", Filter.Text);
        hauptübersichtgrid.ItemsSource = dv;
    }
    

    0 讨论(0)
提交回复
热议问题