如何在Windows Phone页面上强制绑定更新? [英] How to force the binding update on Windows Phone Page?

查看:73
本文介绍了如何在Windows Phone页面上强制绑定更新?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Windwos Phone页面,上面有多个TextBox控件。 TextBox控件是TwoWay绑定到类。我有一个ApplicationBar按钮 - "保存",它会将类信息保存到IsolatedStorage。

I have a Windwos Phone page with multiple TextBox controls on it. The TextBox controls are TwoWay binded to a class. I have an ApplicationBar button - "Save", that will save the class info into IsolatedStorage.

当我将数据输入TextBox时,如果光标位于TextBox上;我按下"保存"按钮按钮,这最后一个TextBox不会将其内容更新到类中。如果我首先将焦点更改为另一个控件,则数据会正确更新为
类。

As I input data into the TextBoxes, if the cursor is on a TextBox and I press the "Save" button, this last TextBox will not update its content into the class. If I first change the focus to another control, the data is updated correctly into the class.

是否可以强制所有TextBox更新类?

Any way to force all the TextBox to update the class?

谢谢,¥b $ b EitanB

Thanks,
EitanB

推荐答案

听起来好像没有"支持"绑定文本框的属性和/或没有INPC或Dependencyproperty实现。 为了使双向绑定工作,必须向WPF发送某种通知,只有两种方法可以实现。 
DependencyProperty(我最喜欢的)和INotifyPropertyChanged接口实现!
It sounds as if there is no "Backing" property to the bound textbox and or there is no INPC or Dependencyproperty implementation.  In order for two-way binding to work there must be some sort of notification to WPF, there are only two ways to do it.  DependencyProperty (my favorite) and INotifyPropertyChanged interface implementation!


这篇关于如何在Windows Phone页面上强制绑定更新?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆