UIElement.PreviewTextInput Event


在此元素以设备无关模式获取文本时发生。Occurs when this element gets text in a device-independent manner.

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



PreviewTextInput 事件允许组件或应用程序以与设备无关的方式侦听文本输入。The PreviewTextInput event allows a component or application to listen for text input in a device-independent manner. 键盘是 PreviewTextInput的主要方法;但语音、手写和其他输入设备还可以生成 PreviewTextInputThe keyboard is the primary means of PreviewTextInput; but speech, handwriting, and other input devices can also generate PreviewTextInput.

由于键组合(在默认键盘或通过输入法编辑器)中,多个键事件可能只引发一个文本输入事件。Because of key combinations - either in default keyboards or through input method editors - multiple key events may raise just one text input event.

此事件创建此类的 TextCompositionManager.PreviewTextInput 附加事件的别名,以便在将 UIElement 作为基元素继承时,PreviewTextInput 是类成员列表的一部分。This event creates an alias for the TextCompositionManager.PreviewTextInput attached event for this class, so that PreviewTextInput is part of the class members list when UIElement is inherited as a base element. 附加到 PreviewTextInput 事件的事件处理程序附加到基础 TextCompositionManager.PreviewTextInput 附加事件,并接收相同的事件数据实例。Event handlers that are attached to the PreviewTextInput event are attached to the underlying TextCompositionManager.PreviewTextInput attached event and receive the same event data instance.

路由事件信息Routed Event Information

标识符字段Identifier field PreviewTextInputEvent
路由策略Routing strategy 隧道Tunneling
委托Delegate TextCompositionEventHandler

Applies to

See also