Reputation: 5165
I have a LostFocus event attached to my TextBox. This TextBox is bound to a ViewModel. However when I lose focus on the TextBox and enter the LostFocus event I find that that the property on the ViewModel has not been updated. It is still showing the old value that I had in the TextBox.
What event should I be using to ensure the ViewModel is updated before I execute any code in my event?
I realise that this might not be normal design, but just to give you some background. I have a grid with dynamic columns that are based on the contexts on the TextBox. I updated these when the TextBox loses focus. I also have a validation rule against the TextBox.
Upvotes: 1
Views: 561
Reputation: 2412
in your Binding something like
Text="{Binding Path=Val}"
make sure yout also have
UpdateSourceTrigger=PropertyChanged
Upvotes: 3