ContentElement.TextInput 事件

定义

当此元素以独立于设备的方式获取文本时发生。

public:
 virtual event System::Windows::Input::TextCompositionEventHandler ^ TextInput;
public event System.Windows.Input.TextCompositionEventHandler TextInput;
member this.TextInput : System.Windows.Input.TextCompositionEventHandler 
Public Custom Event TextInput As TextCompositionEventHandler 

事件类型

实现

注解

Important

此事件可能已被复合控件的内部实现标记为处理。 请参阅下面的备注。

事件 TextInput 可能已标记为由复合控件的内部实现处理。 例如,一个 TextBox 复合控件,其中 TextInput 事件已标记为已处理;在其组合中。 控件执行此操作是因为控件需要解释某些类型的输入,如箭头键,因为该控件具有特殊含义。 如果用作 PreviewTextInput 附加文本输入处理程序的事件,可能会获得更好的结果。 此方法避开了控制组合已将此事件标记为已处理且阻止处理程序沿事件路由接收事件的情况。

事件 TextInput 允许组件或应用程序以独立于设备的方式侦听文本输入。 键盘是主要手段 TextInput,但语音、手写等输入设备也可以引发 TextInput

由于键组合(无论是在默认键盘中还是通过输入法编辑器),多个键事件可能只引发一个文本输入事件。

此事件为 TextCompositionManager.TextInput 此类的附加事件创建别名,以便在 TextInput 继承为基元素时 ContentElement 成为类成员列表的一部分。 附加到 TextInput 事件的事件处理程序将附加到基础 TextCompositionManager.TextInput 附加事件并接收相同的事件数据实例。

路由事件信息

项目 价值
标识符字段 TextInputEvent
路由策略 鼓 泡
代理 TextCompositionEventHandler

适用于