TextBox绑定TwoWay不更新直到焦点丢失WP7 [英] TextBox Binding TwoWay Doesn't Update Until Focus Lost WP7
问题描述
TwoWay
。如果文本框失去焦点,我的视图模型中的数据将被更新。如果我点击一个按钮,如保存,文本框仍然具有焦点,文本框中的更改在保存事件的视图模型中不会更改。 有没有办法让绑定保存文本框的值失去焦点?还是需要在保存事件中做一些事情?
您可以使用 http://compositewpf.codeplex.com =noreferrer> WP7的Prism库更新文本更改而不是丢失焦点时的绑定值。
I have a page with some text boxes for data input. The binding of the text box is set to TwoWay
. The data in my view model only gets updated if the text box loses focus. If I click a button, such as save, and the text box still has the focus, the changes in the text box aren't changed in my view model on the save event.
Is there a way to have the binding save the value of the text box before it loses focus? Or do I need to do something in the save event?
You can use the UpdateTextBindingOnPropertyChanged
behavior from the Prism Library for WP7 to update the bound value when the text changes instead of on lost focus.
这篇关于TextBox绑定TwoWay不更新直到焦点丢失WP7的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!