Skip to main content

ITextViewHost Interface

Definition​

Assembly:Avalonia.Controls.Documents
Package:Avalonia.Controls.Documents

Represents the host container for a text view, providing viewport and scrolling capabilities.

public interface ITextViewHost

Remarks​

This interface separates viewport management (which belongs to the host container like RichTextEditor) from text rendering (which belongs to ITextView / TextViewBase). Typically implemented by controls that contain a ScrollViewer and a text view.

Methods​

NameDescription
BringRectIntoViewScrolls to bring the specified rectangle into view.

BringRectIntoView Method​

Scrolls to bring the specified rectangle into view.

public bool BringRectIntoView(Avalonia.Rect rect)

Parameters​

rect Avalonia.Rect

The rectangle to bring into view (in text view coordinates).

Returns​

bool

True if scrolling occurred, false otherwise.

Properties​

NameDescription
ExtentGets the extent (total content size).
OffsetGets or sets the current scroll offset.
TextViewGets the text view being hosted.
ViewportGets the viewport (visible area size).

Extent Property​

Gets the extent (total content size).

public Avalonia.Size Extent { get; set; }

Offset Property​

Gets or sets the current scroll offset.

public Avalonia.Vector Offset { get; set; }

Remarks​

When setting, the offset will be clamped to valid scroll bounds.

TextView Property​

Gets the text view being hosted.

public Avalonia.Controls.Documents.Primitives.ITextView TextView { get; set; }

Viewport Property​

Gets the viewport (visible area size).

public Avalonia.Size Viewport { get; set; }