简体   繁体   English

为什么当我们以编程方式更改其文本时,TextBox 的 Text_Changed 事件不会触发?

[英]Why Text_Changed event of TextBox does not fire when we change its text programmatically?

I have designed a softkeypad and changing textbox text programmatically such as我设计了一个软键盘并以编程方式更改文本框文本,例如

myKeypad.getControl.Text += "Char";

but textbox textchanged event does not fire.但文本框 textchanged 事件不会触发。 How can I solve this problem?我怎么解决这个问题? Is it possible that we can create custom textChanged and KeyPressed Events which can fire by changing text or key press by softkeypad programmatically?我们是否可以创建自定义 textChanged 和 KeyPressed 事件,这些事件可以通过以编程方式更改文本或软键盘按键来触发?

It should be triggered.它应该被触发。

From MSDN Control.TextChanged Event :来自 MSDN Control.TextChanged 事件

This event is raised if the Text property is changed by either a programmatic modification or user interaction.如果通过编程修改或用户交互更改了 Text 属性,则会引发此事件。

Where are you adding the Event Handler?您在哪里添加事件处理程序?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 text_changed事件不起作用 - text_changed event not working Text_Changed问题 - Text_Changed problems 如何使用caliburn.micro和视图模型在text_changed事件中执行TextBox.scrolltoend - How to execute TextBox.scrolltoend in text_changed event using caliburn.micro using view model 如何在C#中使用多个事件处理程序text_changed? - How to use multiple event handler text_changed in C#? 当文本由javascript更改时,Fire TextChanged用于文本框 - Fire TextChanged for textbox when the text changed by javascript 如何在C#winforms中为表单上的多个文本框控件调用Text_Changed事件 - How call the Text_Changed Event for multiple text box controls on a form in C# winforms 使用WM_SETTEXT设置记事本文本不会影响记事本实例中的Text_Changed事件 - Using WM_SETTEXT to set Notepad text is not affecting Text_Changed event in the Notepad instance 如果文本未更改,是否会触发TextChanged事件? - Does a TextChanged event fire if the text hasn't changed? wpf textBox文本已更改事件 - wpf textBox Text Changed event 为什么“绑定文本框”不修改其关联属性,因为“文本”值是通过编程方式设置的? - Why does a Bound Textbox not modify its associated property is the Text value is set programmatically?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM