tags:

views:

51

answers:

1

I have a user interface where a user can enter a value and that value is updated in the ViewModel (and eventually written back to a database).

This works fine if the a value is actually entered. But if you want to clear that value (i.e. set it to nothing) it doesn't seem to work.

So for example if it was 'dog' but I clear that text and "save" the change is not recognized.

I call "PropertyChanged" which is fired if a value is entered. But if the text is cleared, and I hit enter or tab out of the textbox, the property is not updated.

Is there some special way to deal with this or am I just missing something?

thanks

A: 

As indicated by Veer in the comments above try using UpdateSourceTrigger as follows to detect when you change the text. Set a break point in your view model and see if you capture the change events when you type in the text box.

 <TextBox Text="{Binding Path=Name, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
Zamboni