UIElement.TextInput UIElement.TextInput UIElement.TextInput UIElement.TextInput Event

定義

此元素以一種與裝置無關的方式取得文字時發生。Occurs when this element gets text in a device-independent manner.

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 

實作

備註

重要

這個事件可能已經標示為由複合控制項的內部執行所處理。This event might already be marked as handled by the internal implementations of composited controls. 請參閱下面的批註。See Remark below.

TextInput事件可能已標示為由複合控制項的內部執行所處理。The TextInput event may already be marked as handled by the internal implementations of composited controls. 例如, TextBox是一個複合控制項, TextInput其中事件已標示為已處理; 在其複合中。For example, a TextBox is a composited control where the TextInput event is already marked as handled; within its compositing. 控制項會執行這項操作, 因為控制項必須解讀某些類型的輸入 (例如方向鍵), 對該控制項具有特殊意義。Controls do this because the control needs to interpret some types of input, such as arrow keys, as having special meaning to that control. 如果您使用PreviewTextInput做為附加文字輸入之處理常式的事件, 您可能會得到更好的結果。If you use PreviewTextInput as the event where you attach handlers for text input, you may receive better results. 這項技術會規避控制群組合已將此事件標示為已處理的大多數情況, 並防止您的處理常式接收事件路由的事件。This technique circumvents most cases where control composition has already marked this event as handled and prevents your handler from receiving the event along the event route.

TextInput事件可讓元件或應用程式以與裝置無關的方式接聽文字輸入。The TextInput event allows a component or application to listen for text input in a device-independent manner. 鍵盤是的主要方法TextInput, 但是語音、手寫和其他輸入裝置也可以引發。 TextInputThe keyboard is the primary means of TextInput, but speech, handwriting, and other input devices can also raise TextInput.

由於按鍵組合 (在預設鍵盤或透過輸入法編輯器), 因此多個按鍵事件可能只會引發一個文字輸入事件。Because of key combinations - either in default keyboards or through input method editors - multiple key events might raise just one text input event.

這個事件TextInput會為這個類別建立TextCompositionManager.TextInput附加事件的別名, 因此當繼承為基底專案時UIElement , 就是類別成員清單的一部分。This event creates an alias for the TextCompositionManager.TextInput attached event for this class, so that TextInput is part of the class members list when UIElement is inherited as a base element. 附加至TextInput事件的事件處理常式會附加至基礎TextCompositionManager.TextInput附加事件, 並接收相同的事件資料實例。Event handlers that are attached to the TextInput event are attached to the underlying TextCompositionManager.TextInput attached event and receive the same event data instance.

路由事件資訊Routed Event Information

識別碼欄位Identifier field TextInputEvent
路由策略Routing strategy 路由Bubbling
Delegate - 委派Delegate TextCompositionEventHandler

適用於