An annoying bug (Or Feature) of developing for Windows Phone 7.1.
I’ve been writing a Windows Phone 7.1 app that uses the MVVM model. I have a view that allows me to enter some text and the only other thing on the view is an App Bar button which saves the text.
From what I can gather, the data binding will cause an update once the text box has lost focus. But in this case pressing the App Bar button does not cause the text box to lose focus, so the data update doesn’t happen.
In my case it was an easy work around to give the TextBox a name and update the view model from within the code behind.
TextBox Text="{Binding Path=SomeText, Mode=TwoWay}" x:Name="aTextBox" Grid.Row="1"
_viewModel.SomeText = aTextBox.Text
_viewModel.Save()
But it sort of defeats the object of data bound items.
Leave a Reply