ITextProvider2 interface

Applies to Windows and Windows Phone

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 ITextProvider2 : ITextProvider




The ITextProvider2 interface has these types of members:


The ITextProvider2 interface has these methods. It also inherits methods from the Object class.

GetCaretRange Retrieves a zero-length text range at the location of the caret that belongs to the text-based control.
RangeFromAnnotation Exposes a text range that contains the text that is the target of the annotation associated with the specified annotation element.



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.


Minimum supported client

Windows 8

Minimum supported server

Windows Server 2012

Minimum supported phone

Windows Phone 8.1 [Windows Runtime apps only]


Windows::UI::Xaml::Automation::Provider [C++]



See also

Text and TextRange Control Patterns
Custom automation peers
ITextProvider2 (COM interface)



© 2014 Microsoft