Not really sure how to tackle this issue:
I have a "Save" button that has access keys attached to it... but, if I type something into a textbox and press the access keys to save, the textbox doesn't update my viewmodel because it never lost focus. Any way to solve this outside of changing the UpdateSourceTrigger to PropertyChanged?
Your problem is the
UpdateSourceTrigger="LostFocus"
This is default for TextBoxes, and means that the TextBox will only update its bound value when it loses focus
One way to force it to update without setting
UpdateSourceTrigger="PropertyChanged"
is to hook into the KeyPress event and if the key combination is something that would trigger a save, callUpdateSource()
firstHere's an Attached Property I like using when the Enter key should update the source.
It is used like this:
and the Attached Property definition looks like this: