Dela via


CoreTextEditContext Class

Definition

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

public ref class CoreTextEditContext sealed
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
class CoreTextEditContext final
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
public sealed class CoreTextEditContext
Public NotInheritable Class CoreTextEditContext
Inheritance
Object Platform::Object IInspectable CoreTextEditContext
Attributes

Windows requirements

Device family
Windows 10 (introduced in 10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced in v1.0)

Remarks

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

Version history

Windows version SDK version Value added
1511 10586 NotifyFocusLeaveCompleted

Properties

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.

InputScope

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

IsReadOnly

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

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.

Methods

NotifyFocusEnter()

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

NotifyFocusLeave()

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

NotifyLayoutChanged()

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

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.

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.

Events

CompositionCompleted

Occurs when composition has completed.

CompositionStarted

Occurs when composition has started.

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.

FormatUpdating

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

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.

NotifyFocusLeaveCompleted

Occurs after focus has left the text input control.

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.

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.

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.

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.

Applies to

See also