I have textbox with Text property binded to viewmodel. I have binded TextChanged event to viewmodel.
But the problem is that the event fires every sign is added to textbox(that's good) and Text in viewmodel is refreshed when textbox lost focus(that's bad for me).
How to make this Text property refreshing after each sign?
Or how to send sender as parameter? I think sender would have resfreshed data.
My interactivity xaml:
<interactivity:Interaction.Triggers>
<interactivity:EventTrigger EventName="TextChanged">
<helpers:CustomCommandInvoker Command="{Binding UnlockChangedCommand}" />
</interactivity:EventTrigger>
</interactivity:Interaction.Triggers>
I'm using RelayCommand.
There is a really simple answer to this; use UpdatePropertyTrigger=PropertyChanged. This will update your VM property each time a character is changed. No need for triggers or commands :-)
<TextBox Text="{Binding ViewModelProperty, UpdateSourceTrigger=PropertyChanged}"></TextBox>
Read here for more info: http://msdn.microsoft.com/en-us/library/system.windows.data.updatesourcetrigger(v=vs.110).aspx
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With