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 自动化客户端通过侦听相应的UI 自动化元素事件来跟踪插入点更改,而不是根据 TextSelectionChangedEvent

UI 自动化客户端应用程序使用此标识符,UI 自动化提供程序应使用 TextPatternIdentifiers 中的等效字段。

适用于

另请参阅