I have a TextBox
that a user can enter a search term into it. Its binding to string Term
property in my view-model
. And I want to do a search query when its contents have changed. But I want to make a request in a separate thread with a delay .
eg. when the user enters a letter, I want to wait 0.3 seconds , and if the user changes the input during this time (0.3 seconds), the timer resets and starts again. Otherwise, I start a new thread and execute a search query. During query execution, if the user changes the term again, interrupt the previous query and run it again.
I know how to do this in windows forms with streams and Timer
. But I'm new to WPF
, and I am looking to see if there is a way defined for streaming WPF functions (or maybe there is a way with better performance).
Do you have any ideas? Can you help me?
source share