ITextProvider2 ITextProvider2 ITextProvider2 ITextProvider2 Interface


Extends the ITextProvider interface to enable Microsoft UI Automation providers to expose textual content that is the target of an annotation or selection. Implement this interface in order to support the capabilities that an automation client requests with a GetPattern call and PatternInterface.Text2.

public : interface ITextProvider2public interface ITextProvider2Public Interface ITextProvider2// This API is not available in Javascript.
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Inherited Members

Inherited properties

Inherited methods


For more info on this pattern, see Text and TextRange Control Patterns.

ITextProvider, ITextProvider2 and ITextRangeProvider aren't implemented by any existing Windows Runtime automation peers using this definition of the interface. The text models supported by Windows Runtime text controls such as TextBox and RichTextBlock do implement some of these patterns, but do so at a native level that doesn't appear in the Windows Runtime definitions of the API surface. For more info, see the peer classes for the various Windows Runtime text controls.

The ITextProvider2 pattern doesn't have a Windows Runtime property identifier class.

Interface inheritance

ITextProvider2 inherits ITextProvider. Types that implement ITextProvider2 also implement the interface members of ITextProvider.


GetCaretRange(Boolean) GetCaretRange(Boolean) GetCaretRange(Boolean) GetCaretRange(Boolean)

Retrieves a zero-length text range at the location of the caret that belongs to the text-based control.

public : ITextRangeProvider GetCaretRange(bool isActive)public ITextRangeProvider GetCaretRange(Boolean isActive)Public Function GetCaretRange(isActive As Boolean) As ITextRangeProvider// This API is not available in Javascript.
bool Boolean Boolean Boolean

true if the text-based control that contains the caret has keyboard focus; otherwise, false.


A text range that represents the current location of the caret that belongs to the text-based control.

RangeFromAnnotation(IRawElementProviderSimple) RangeFromAnnotation(IRawElementProviderSimple) RangeFromAnnotation(IRawElementProviderSimple) RangeFromAnnotation(IRawElementProviderSimple)

Exposes a text range that contains the text that is the target of the annotation associated with the specified annotation element.

public : ITextRangeProvider RangeFromAnnotation(IRawElementProviderSimple annotationElement)public ITextRangeProvider RangeFromAnnotation(IRawElementProviderSimple annotationElement)Public Function RangeFromAnnotation(annotationElement As IRawElementProviderSimple) As ITextRangeProvider// This API is not available in Javascript.
IRawElementProviderSimple IRawElementProviderSimple IRawElementProviderSimple IRawElementProviderSimple

The provider for an element that implements the IAnnotationProvider interface. The annotation element is a sibling of the element that implements the ITextProvider2 interface for the document.


A text range that contains the annotation target text.

See Also