I want to create a simple search box, so I have a text box, and when someone enters a search query, I want to execute a search method.
The problem is that the onChange method is executed when I change the click from the text field, and I want the onChange event to be fired during input.
<TextBox Text="{Binding SearchTerm}" />
public static readonly DependencyProperty SearchTermProperty =
DependencyProperty.Register("SearchTerm", typeof(string), typeof(MainWindow), new PropertyMetadata(string.Empty, OnCaptionPropertyChanged));
private static void OnCaptionPropertyChanged(DependencyObject dependencyObject,
DependencyPropertyChangedEventArgs e)
{
((MainWindow)dependencyObject).SearchTracks(e.NewValue.ToString());
}
Thank!
source
share