当将文本键入到TextBox中时,立即触发TextChanged事件 [英] Having TextChanged Event Fire Immediately as Text is Typed into TextBox

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

问题描述

在具有TextChanged事件的wpf TextBox上,它似乎仅在焦点从文本框移开时才触发;但不是因为输入了单个字符.

On a wpf TextBox that has an TextChanged event, it seems to only fires when focus is taken away from the textbox; but not as individual characters are typed in.

是否存在类似于TextChanged的事件,当在文本框中键入字符时而不是在焦点改变时会立即触发 ?

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

推荐答案

您可以绑定Text属性并使用

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

UpdateSourceTrigger=PropertyChanged

通过将其设置为PropertyChanged,每当文本更改时,您都会收到一条通知.

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

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

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