Unfortunately you cannot use the LostFocus event for this purpose. If you test the same behavior when using TextBox instead of MaskedTextInput, you will see that again the LostFocus event is not fired if you click outside the Window. Every application/window has its own Keyboard Focus and when you click outside it and after that again on it the focused element is preserved. That is why the LostFocus is not fired.
What I can suggest is to use the Window Deactivated event and check whether the focus is on the MaskedTextInput:
sender, EventArgs e)
You need to implement some custom logic depending on your requirements.