Reputation: 97
I have a MVVM app, which shows a TextBox with its text bound to a viewmodel property:
Text="{Binding Path=Caption, Mode=TwoWay}
The update of 'Caption' property happens only when putting cursor to any other control. Is there a way, a good way, to have the 'Caption' property updated immediately when typing any char? I need this because my app displays a view twice, in same window - one is real 'work area', another - a 'thumbnail', in a listbox of all loaded 'work areas'. 'Work area' would show the new text correctly. A 'thumbnail' updates the textbox only when it loses cursor
Upvotes: 1
Views: 191
Reputation: 5301
For the text property, the default way to update bindings is LostFocus not PropertyChanged, you need to set this explicitly.
Text="{Binding Path=Caption, Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}
Upvotes: 4