TextPattern.TextSelectionChangedEvent 字段

定义

标识在修改文本选择时引发的事件。Identifies the event raised when the text selection is modified.

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)

注解

某些文本控件将文本插入点(光标)作为零宽度文本选择进行处理,并且可能会在移动光标时引发 TextSelectionChangedEventSome text controls handle the text insertion point (cursor) as a zero-width text selection and might raise TextSelectionChangedEvent when the cursor is moved.

备注

为了跟踪游标变动,建议 UI 自动化客户端通过侦听相应的 UI 自动化UI Automation 元素事件来跟踪插入点更改,而不是根据 TextSelectionChangedEventTo follow cursor movements, UI Automation clients are advised to keep track of insertion point changes by listening for corresponding UI 自动化UI Automation element events rather than depending on TextSelectionChangedEvent.

此标识符由 UI 自动化客户端应用程序使用,UI 自动化提供程序应在 TextPatternIdentifiers中使用等效字段。This identifier is used by UI Automation client applications UI Automation providers should use the equivalent field in TextPatternIdentifiers.

适用于

另请参阅