I​Text​Range​Provider2 I​Text​Range​Provider2 I​Text​Range​Provider2 Interface


Extends the ITextRange interface to enable Microsoft UI Automation providers to programmatically open context menus that are contextual to text input operations.

public interface ITextRangeProvider2public interface ITextRangeProvider2Public Interface ITextRangeProvider2
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Inherited Members

Inherited methods



ShowContextMenu() ShowContextMenu() ShowContextMenu()

Shows the available context menu for the owner element.

public void ShowContextMenu()public void ShowContextMenu()Public Function ShowContextMenu() As void


From the client perspective, ShowContextMenu isn't intended for general cases where an app defines the UI and also defines a discrete UI element that is presented as a menu, flyout, or other UI metaphor as a result of handling an app input event. Such context menus are already controllable for automation and should appear in expected locations in a Microsoft UI Automation tree once that context is entered. ShowContextMenu is specifically intended for cases where text entry into a text control results in that control displaying UI elements that aren't specified by the app's XAML or code, which come from the control's internal logic or templated states. These context menus typically present the UI for a service operation that the text control supports and that the user is expected to interact with before they can exit that context. Some example control scenarios are input method editors handling text at the input level and presenting completion choices, or auto-complete and spell-checking for text input in a TextBox or similar control.