Skip to content

TextBase class

Base class for text input controls built on the managed text engine.

Guide: C# Markup reference: Textbox

public abstract class TextBase : Control, ITextCompositionClient, ITextInputClient
name description
AcceptTab { get; set; } Gets or sets whether Tab inserts a tab character instead of moving focus.
CanRedo { get; } Gets whether an undone edit can be redone.
CanUndo { get; } Gets whether an edit can be undone.
CaretPosition { get; set; } Gets or sets the caret position as a character index into the document.
CaretVisible { get; } Whether the caret is in the visible half of its blink. A layer drawing the caret in place of the built-in one reads this instead of keeping a second clock. Carries no render option: the blink invalidates the caret alone, and a whole-visual invalidation would undo that.
ClipboardService { get; set; } Gets or sets an optional clipboard override for hosted editors and tests.
ImeMode { get; set; } Gets or sets the IME mode for this text control.
IsReadOnly { get; set; } Gets or sets whether the text is read-only.
MaxLength { get; set; } Gets or sets the maximum text length in UTF-16 code units. 0 means unlimited.
Placeholder { get; set; } Gets or sets the placeholder text shown while the document is empty.
SelectionBackground { get; set; } Gets or sets the color painted behind the selected text; the default style dims it while the control does not have focus.
SelectionForeground { get; set; } Gets or sets the color the selected glyphs are painted in; null keeps their own colors, so a colorized document stays readable through a selection.
SelectionLength { get; } Gets the selection length in UTF-16 code units.
SelectionStart { get; } Gets the selection start as a character index.
event TextChanged Occurs when the text changes.
event TextCompositionEnd Occurs when an IME composition ends.
event TextCompositionStart Occurs when an IME composition starts.
event TextCompositionUpdate Occurs when the IME composition text changes.
event TextInput Occurs when the control receives text input.
AppendText(…) Appends text at the end of the document without allocating a full new Text string.
Copy()
Cut()
abstract GetCharRectInWindow(…) Returns the rectangle at the given character index in window coordinates (DIPs).
MoveCaret(…) Moves the caret, keeping the selection anchor where it is when extending. Extending is what a shifted arrow key does, and it is the only way to build a selection whose caret sits at its start: Select always leaves the caret at the end.
Paste()
Redo()
ReplaceSelection(…)
ScrollToCaret() Scrolls the view so the caret is visible.
Select(…)
SelectAll()
Undo()
static readonly AcceptTabProperty
static readonly CaretVisibleProperty
static readonly ImeModeProperty
static readonly IsReadOnlyProperty
static readonly MaxLengthProperty
static readonly PlaceholderProperty
static readonly SelectionBackgroundProperty
static readonly SelectionForegroundProperty
static readonly SelectionLengthProperty
static readonly SelectionStartProperty