Skip to content

MultiLineTextBox class

Multi-line editor built on the extensible text view engine. It does not use the legacy Controls.Text formatter, view, or measurement caches.

Guide: C# Markup reference: Textbox

public sealed class MultiLineTextBox : TextBase, ITextViewHost
name description
MultiLineTextBox() The default constructor.
MultiLineTextBox(…)
DefaultBaseline { get; }
DefaultLineHeight { get; }
Document { get; set; } Gets or sets the backing document; assigning a new one keeps the view and extension registrations while caret, selection, scroll and undo history reset.
EditableRegions { get; set; } Gets or sets the provider consulted before every edit; null leaves the document fully editable.
Extensions { get; } Gets the extension pipeline of the text view.
ExtentHeight { get; }
ExtentWidth { get; }
HorizontalOffset { get; } Gets the horizontal scroll offset in DIPs.
Layers { get; }
ScrollOffset { get; }
SelectedText { get; } Gets the currently selected text.
SizeToDocument { get; set; } Gets or sets whether the desired size is the document’s extent clamped to the offered space, instead of the offered space itself; the default is false.
TabSize { get; set; } Gets or sets the tab width in space characters.
Text { get; set; } Gets or sets the text content.
TextViewportBounds { get; } Gets the bounds the text is drawn in, in local coordinates.
VerticalOffset { get; } Gets the vertical scroll offset in DIPs.
VerticalScrollBarVisibility { get; set; } Gets or sets when the vertical scrollbar is shown; the text scrolls either way.
VisibleTextLines { get; } Gets the line layouts currently materialized.
Wrap { get; set; } Gets or sets whether lines wrap at the viewport width.
event DocumentChanged Raised after the document content changed or the document was replaced.
event EditingStateChanged Occurs when the caret, the selection or the undo state changes.
event LineConstructionStarting
event LinesChanged
event ScrollOffsetChanged
event TextCommitted Raised after typed or composed text reached the document, once per commit.
event WrapChanged Occurs when Wrap changes.
EnterText(…) Replaces a document range the way a user types over it: the caret lands at the end of the inserted text, undo returns to where the caret was, and EditableRegions is honored. ReplaceRange is the programmatic counterpart.
FindLineByY(…)
override GetCharRectInWindow(…)
GetLineExtent(…)
GetLineLayout(…)
GetLineY(…)
InsertLayer(…)
InvalidateLayer(…)
InvalidateTextRange(…)
InvalidateTextView() Re-runs registered classifiers, generators, projections, and layers.
override InvalidateVisual() Discards the box’s own drawing and every layer’s, unless only the frame changed.
MakeVisible(…)
ReplaceRange(…) Replaces a document range the way a program does rather than a user: the caret rides along with the surrounding text, and neither IsReadOnly nor EditableRegions is consulted. The change stays undoable.
static readonly SizeToDocumentProperty
static readonly TabSizeProperty
static readonly TextProperty
static readonly VerticalScrollBarVisibilityProperty
static readonly WrapProperty