CoreTextEditContext CoreTextEditContext CoreTextEditContext CoreTextEditContext Class

Definition

The primary object used by text input controls to communicate with the text input server.

public : sealed class CoreTextEditContext : ICoreTextEditContext, ICoreTextEditContext2public sealed class CoreTextEditContext : ICoreTextEditContext, ICoreTextEditContext2Public NotInheritable Class CoreTextEditContext Implements ICoreTextEditContext, ICoreTextEditContext2// You can use this class in JavaScript.
Attributes
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Remarks

To obtain an object of this type, call CoreTextServicesManager.CreateEditContext.

Properties

InputPaneDisplayPolicy InputPaneDisplayPolicy InputPaneDisplayPolicy InputPaneDisplayPolicy

Gets or sets a value that indicates whether the input pane should be shown automatically when focus enters your text input control. The default value is Automatic, indicating that the input pane will be shown automatically. A value of Manual indicates that your app will be responsible for showing and hiding the input pane using InputPane.TryShow and TryHide.

public : CoreTextInputPaneDisplayPolicy InputPaneDisplayPolicy { get; set; }public CoreTextInputPaneDisplayPolicy InputPaneDisplayPolicy { get; set; }Public ReadWrite Property InputPaneDisplayPolicy As CoreTextInputPaneDisplayPolicy// You can use this property in JavaScript.

InputScope InputScope InputScope InputScope

Gets or sets a value that indicates the input scope of the text input control.

public : CoreTextInputScope InputScope { get; set; }public CoreTextInputScope InputScope { get; set; }Public ReadWrite Property InputScope As CoreTextInputScope// You can use this property in JavaScript.
Value
CoreTextInputScope CoreTextInputScope CoreTextInputScope CoreTextInputScope

One of the CoreTextInputScope enumeration values. The default is Default.

IsReadOnly IsReadOnly IsReadOnly IsReadOnly

Gets or sets a value that indicates whether the edit control is editable.

public : PlatForm::Boolean IsReadOnly { get; set; }public bool IsReadOnly { get; set; }Public ReadWrite Property IsReadOnly As bool// You can use this property in JavaScript.
Value
PlatForm::Boolean bool bool bool

true if the text input control is read-only; otherwise, false. The default is false.

Name Name Name Name

Gets or sets a descriptive name for the text input control. An application framework usually uses properties such as "name" or "id" to identify a control, so it’s recommended that you set this property accordingly on the text input server so that input processors can better preserve the input context, and provide better suggestions.

public : PlatForm::String Name { get; set; }public string Name { get; set; }Public ReadWrite Property Name As string// You can use this property in JavaScript.
Value
PlatForm::String string string string

A string containing a descriptive name for the text input control.

Methods

NotifyFocusEnter() NotifyFocusEnter() NotifyFocusEnter() NotifyFocusEnter()

Notifies the text input server that focus has entered the text input control.

public : void NotifyFocusEnter()public void NotifyFocusEnter()Public Function NotifyFocusEnter() As void// You can use this method in JavaScript.

NotifyFocusLeave() NotifyFocusLeave() NotifyFocusLeave() NotifyFocusLeave()

Notifies the text input server that focus has left the text input control.

public : void NotifyFocusLeave()public void NotifyFocusLeave()Public Function NotifyFocusLeave() As void// You can use this method in JavaScript.

NotifyLayoutChanged() NotifyLayoutChanged() NotifyLayoutChanged() NotifyLayoutChanged()

Notifies the text input server that the layout of text inside the text input control has changed.

public : void NotifyLayoutChanged()public void NotifyLayoutChanged()Public Function NotifyLayoutChanged() As void// You can use this method in JavaScript.

NotifySelectionChanged(CoreTextRange) NotifySelectionChanged(CoreTextRange) NotifySelectionChanged(CoreTextRange) NotifySelectionChanged(CoreTextRange)

Notifies the text input server about any change that the text input control needs to make to the selection range. This is important in order to keep the internal state of the control and the internal state of the server synchronized.

public : void NotifySelectionChanged(CoreTextRange selection)public void NotifySelectionChanged(CoreTextRange selection)Public Function NotifySelectionChanged(selection As CoreTextRange) As void// You can use this method in JavaScript.
Parameters
selection
CoreTextRange CoreTextRange CoreTextRange CoreTextRange

The range of selection currently in effect.

NotifyTextChanged(CoreTextRange, Int32, CoreTextRange) NotifyTextChanged(CoreTextRange, Int32, CoreTextRange) NotifyTextChanged(CoreTextRange, Int32, CoreTextRange) NotifyTextChanged(CoreTextRange, Int32, CoreTextRange)

Notifies the text input server about any change that the text input control needs to make to the text. This is important in order to keep the internal state of the control and the internal state of the server synchronized. Since a change to the text is also likely to affect the selection range, the method takes the selection range as a parameter.

public : void NotifyTextChanged(CoreTextRange modifiedRange, int newLength, CoreTextRange newSelection)public void NotifyTextChanged(CoreTextRange modifiedRange, Int32 newLength, CoreTextRange newSelection)Public Function NotifyTextChanged(modifiedRange As CoreTextRange, newLength As Int32, newSelection As CoreTextRange) As void// You can use this method in JavaScript.
Parameters
modifiedRange
CoreTextRange CoreTextRange CoreTextRange CoreTextRange

The range of text to replace, in terms of the state the text buffer is in prior to this text change.

newLength
int Int32 Int32 Int32

The length of the text that should replace modifiedRange.

newSelection
CoreTextRange CoreTextRange CoreTextRange CoreTextRange

The range of selection in effect after the text change.

Events

CompositionCompleted CompositionCompleted CompositionCompleted CompositionCompleted

Occurs when composition has completed.

public : event TypedEventHandler CompositionCompleted<CoreTextEditContext,  CoreTextCompositionCompletedEventArgs>public event TypedEventHandler CompositionCompleted<CoreTextEditContext,  CoreTextCompositionCompletedEventArgs>Public Event CompositionCompleted<CoreTextEditContext,  CoreTextCompositionCompletedEventArgs>// You can use this event in JavaScript.

CompositionStarted CompositionStarted CompositionStarted CompositionStarted

Occurs when composition has started.

public : event TypedEventHandler CompositionStarted<CoreTextEditContext,  CoreTextCompositionStartedEventArgs>public event TypedEventHandler CompositionStarted<CoreTextEditContext,  CoreTextCompositionStartedEventArgs>Public Event CompositionStarted<CoreTextEditContext,  CoreTextCompositionStartedEventArgs>// You can use this event in JavaScript.

FocusRemoved FocusRemoved FocusRemoved FocusRemoved

Occurs when focus was forcibly removed from a text input control. The application should handle this event to remove focus for the text input control accordingly.

public : event TypedEventHandler FocusRemoved<CoreTextEditContext,  object>public event TypedEventHandler FocusRemoved<CoreTextEditContext,  object>Public Event FocusRemoved<CoreTextEditContext,  object>// You can use this event in JavaScript.

FormatUpdating FormatUpdating FormatUpdating FormatUpdating

Occurs when the text input server needs to apply a different format to a particular range of text. This usually happens during composition.

public : event TypedEventHandler FormatUpdating<CoreTextEditContext,  CoreTextFormatUpdatingEventArgs>public event TypedEventHandler FormatUpdating<CoreTextEditContext,  CoreTextFormatUpdatingEventArgs>Public Event FormatUpdating<CoreTextEditContext,  CoreTextFormatUpdatingEventArgs>// You can use this event in JavaScript.

LayoutRequested LayoutRequested LayoutRequested LayoutRequested

Occurs when the text input server needs to get the bounding box of a range of text and of the text input control itself. The application should handle this event and return the geometry information requested.

public : event TypedEventHandler LayoutRequested<CoreTextEditContext,  CoreTextLayoutRequestedEventArgs>public event TypedEventHandler LayoutRequested<CoreTextEditContext,  CoreTextLayoutRequestedEventArgs>Public Event LayoutRequested<CoreTextEditContext,  CoreTextLayoutRequestedEventArgs>// You can use this event in JavaScript.

NotifyFocusLeaveCompleted NotifyFocusLeaveCompleted NotifyFocusLeaveCompleted NotifyFocusLeaveCompleted

Occurs after focus has left the text input control.

public : event TypedEventHandler NotifyFocusLeaveCompleted<CoreTextEditContext,  object>public event TypedEventHandler NotifyFocusLeaveCompleted<CoreTextEditContext,  object>Public Event NotifyFocusLeaveCompleted<CoreTextEditContext,  object>// You can use this event in JavaScript.
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10586.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v2)

SelectionRequested SelectionRequested SelectionRequested SelectionRequested

Occurs when the text input server needs to get the text range representing the currently selected text in the text input control. The application should handle this event and return the range requested.

public : event TypedEventHandler SelectionRequested<CoreTextEditContext,  CoreTextSelectionRequestedEventArgs>public event TypedEventHandler SelectionRequested<CoreTextEditContext,  CoreTextSelectionRequestedEventArgs>Public Event SelectionRequested<CoreTextEditContext,  CoreTextSelectionRequestedEventArgs>// You can use this event in JavaScript.

SelectionUpdating SelectionUpdating SelectionUpdating SelectionUpdating

Occurs when the text input server needs to modify the range of text currently selected in the text input control. This event could be the result of an input processor needing to select some text, or to move the caret. The text input control should set its selection range accordingly.

public : event TypedEventHandler SelectionUpdating<CoreTextEditContext,  CoreTextSelectionUpdatingEventArgs>public event TypedEventHandler SelectionUpdating<CoreTextEditContext,  CoreTextSelectionUpdatingEventArgs>Public Event SelectionUpdating<CoreTextEditContext,  CoreTextSelectionUpdatingEventArgs>// You can use this event in JavaScript.

TextRequested TextRequested TextRequested TextRequested

Occurs when the text input server needs to get a range of text from the text input control. The application should handle this event and return the range requested.

public : event TypedEventHandler TextRequested<CoreTextEditContext,  CoreTextTextRequestedEventArgs>public event TypedEventHandler TextRequested<CoreTextEditContext,  CoreTextTextRequestedEventArgs>Public Event TextRequested<CoreTextEditContext,  CoreTextTextRequestedEventArgs>// You can use this event in JavaScript.

TextUpdating TextUpdating TextUpdating TextUpdating

Occurs when the text input server needs to modify text inside the text input control. This event could be the result of a key event— such as inserting a single character— or the result of processing done by an input processor, such as auto-correction and prediction.

When handling the event, the text input control must replace a range with the new text provided by the server, and also move the caret to the end of the new text.

public : event TypedEventHandler TextUpdating<CoreTextEditContext,  CoreTextTextUpdatingEventArgs>public event TypedEventHandler TextUpdating<CoreTextEditContext,  CoreTextTextUpdatingEventArgs>Public Event TextUpdating<CoreTextEditContext,  CoreTextTextUpdatingEventArgs>// You can use this event in JavaScript.

See Also