I want to create a simple searchbox, so I have a textbox and when someone types a searchterm I want to execute the search method.
The problem is that the onChange method executes when I change click out of the textbox and I want the onChange event executed while I am typing.
<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());
}
Thanks!
1 Answer