当将文本键入到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.