Search code examples
wpfgridviewtextboxtextchanged

Text changed event of text box in a gridview


I am new in wpf, so i have a problem in my gridview.

I'm using a TextBox in the GridView . Basically, what I want to do is call a method every time the text in the box is edited. That is when the text is entered, the function will call. That is the text change event should work.


Solution

  • Use the TextChanged event.

    .xaml:

    <TextBox TextChanged="TextBox_TextChanged" ... />
    

    .xaml.cs:

    private void TextBox_TextChanged(object sender, TextChangedEventArgs e)
    {
        string text = ((TextBox)sender).Text;
        // call your function
    }