I have an application in which there are many text fields and some buttons like Save, SaveAs, etc.
When a user edits a TextBox, I have to check the database for some range, check the range and update the database. If there is any error in the value entered by the user, then I should not allow the TextBox to lose focus.
I used the LostFocus event to do this, and it worked fine until recently I found an error in my application.
Error: The user edits the value in the TextBox and then clicks the "Save" button; LostFocus event is not raised and therefore the database is not updated :(
Now my question is: what event should I use in the TextBox to update the database. I tried the TextChanged event, but it checks for each character and slows down the application. I am confused about choosing the right event for this kind of application!
Note : ** Buttons are in different UserControl!
EDIT 1: I have some commands attached to the Buttons buttons, these commands run until LostFocus !! Can I set the priority or something like the attached behavior or the commands should be executed after LostFocus !!
EDIT 2: , . , DelegateCommand LostFocus, . ? , MVVM, !