文本框的实时绑定属性更改 [英] Live binding property change for textbox

查看:129
本文介绍了文本框的实时绑定属性更改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的表单中有一个 TextBox 控件,绑定到我的视图模型中的一个属性。当前行为的工作方式是,在控件失去焦点后,视图模型将仅被收到 TextBox 中的文本被修改。

I have a TextBox control on my form that is bound to a property in my view model. The current behaviour works in a way that the view model will only get notified that the text in the TextBox was modified after the control loses focus.

如果 TextBox 实时更改状态,我该如何通知我的视图模型?这附加在我的视图模型中的一个属性,确定是否启用了保存按钮。所以如果我立即在这个 TextBox 中输入一个字母,那么我的保存按钮应该被启用,而不必失去焦点。

How can I inform my view model whenever the TextBox changes state in real time? This is attached to a property in my view model that determines if the save button is enabled. So if I type one letter into this TextBox right away my save button should be enabled without having to lose focus.

推荐答案

更改 UpdateSourceTrigger 绑定到 PropertyChanged

这篇关于文本框的实时绑定属性更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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