TextPattern.TextSelectionChangedEvent 欄位

定義

識別修改文字選取範圍時所引發的事件。

public: static initonly System::Windows::Automation::AutomationEvent ^ TextSelectionChangedEvent;
public static readonly System.Windows.Automation.AutomationEvent TextSelectionChangedEvent;
 staticval mutable TextSelectionChangedEvent : System.Windows.Automation.AutomationEvent
Public Shared ReadOnly TextSelectionChangedEvent As AutomationEvent 

欄位值

範例

// Initialize a selection changed listener.
// The target selection is reflected in the client.
Automation.AddAutomationEventHandler(
    TextPattern.TextSelectionChangedEvent,
    targetDocument,
    TreeScope.Element,
    OnTextSelectionChange);
' Initialize a selection changed listener.
' The target selection is reflected in the client.
Dim onSelectionChanged As AutomationEventHandler = _
New AutomationEventHandler(AddressOf OnTextSelectionChange)
Automation.AddAutomationEventHandler( _
TextPattern.TextSelectionChangedEvent, targetDocument, _
TreeScope.Element, onSelectionChanged)

備註

某些文字控制項會處理游標 (插入點) 為零寬度的文字選取範圍,而且在移動游標時可能會引發 TextSelectionChangedEvent

注意

若要遵循游標移動,建議使用者介面自動化用戶端接聽對應的 UI 自動化元素事件,而不是視 而定 TextSelectionChangedEvent ,以追蹤插入點變更。

使用者介面自動化用戶端應用程式使用者介面自動化提供者應該使用 中的 TextPatternIdentifiers 對等欄位。

適用於

另請參閱