0

I have this textbox

<TextBox  Name="truck_reg_no" />

When a user finishes typing on the textbox i would like to fire an event

I have tried

<TextBox  FocusDisengaged="truck_reg_no_FocusDisengaged"  Name="truck_reg_no"
            />

The FocusDisengaged Is never fired

Which event can i add to achieve that

Geoff
  • 6,277
  • 23
  • 87
  • 197

1 Answers1

0

FocusDisengaged is for game pad/remote interaction. If you want to get notified when input focus is taken away from the TextBox, just use the LostFocus event.

For your requirement, you need an event that is fired after user stops typing (for a while), even if the focus is still on the TextBox. There is no built-in event for this, instead you can implement this logic by utilizing some kind of timer.

The idea is to start a timer with a set interval (like 1 second) when the user types any key. During this interval, if user types another key, the timer is reset and restart again; If the interval is elapsed, you know user has not type any key in the last 1 second.

Here is an example.

kennyzx
  • 12,845
  • 6
  • 39
  • 83