当文本键入时,Fire TextBox.TextChanged立即发送 [英] Fire TextBox.TextChanged immediately when text is typed in

查看:94
本文介绍了当文本键入时,Fire TextBox.TextChanged立即发送的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个wpf文本框,并连接它的TextChanged事件。问题是,当焦点从文本框中移除时,此事件才会触发。



是否有类似于TextChanged的事件立即触发

解决方案

您可以绑定文本属性,并使用 UpdateSourceTrigger

  UpdateSourceTrigger = PropertyChanged 

通过将其设置为 PropertyChanged ,您将在每次文本更改时收到通知。


I've got a wpf TextBox, and wired up it's TextChanged event. The problem is that this event only fires when focus is taken away from the textbox.

Is there an event similar to TextChanged that fires immediately when a character is typed into the textbox, rather than when focus changes?

解决方案

You can bind the Text property and make use of the UpdateSourceTrigger.

UpdateSourceTrigger=PropertyChanged

By setting it to PropertyChanged, you will get a notification each and every time the text changes.

这篇关于当文本键入时,Fire TextBox.TextChanged立即发送的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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