Skip to main content

TextLineInfo Struct

Definition​

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

A lightweight struct representing line information for caret positioning and navigation. Implements Avalonia.Controls.Documents.Primitives.ITextLine as a value type to avoid allocations.

public struct TextLineInfo

Inheritance: ValueType -> TextLineInfo

Implements: ITextLine, IEquatable<TextLineInfo>

Constructors​

NameDescription
TextLineInfoCreates a new TextLineInfo.

TextLineInfo Constructor​

Creates a new TextLineInfo.

public TextLineInfo(Avalonia.Controls.Documents.TextModel.StaticTextPointer startPosition, Avalonia.Controls.Documents.TextModel.StaticTextPointer endPosition, Avalonia.Rect bounds, double baseline, bool hasLineBreak, object containingElement)

Parameters​

startPosition Avalonia.Controls.Documents.TextModel.StaticTextPointer

The start position of the line.

endPosition Avalonia.Controls.Documents.TextModel.StaticTextPointer

The end position of the line.

bounds Avalonia.Rect

The bounding rectangle of the line.

baseline double

The baseline offset from the top.

hasLineBreak bool

Whether the line ends with a hard line break.

containingElement object

The node whose content the line belongs to.

Methods​

NameDescription
Equals (2 overloads)No summary available.
GetHashCodeNo summary available.

Equals overloads​

Equals Method​

public bool Equals(Avalonia.Controls.Documents.Primitives.TextLineInfo other)
Parameters​

other Avalonia.Controls.Documents.Primitives.TextLineInfo

Returns​

bool

Equals Method​

public bool Equals(object obj)
Parameters​

obj object

Returns​

bool

GetHashCode Method​

public int GetHashCode()

Returns​

int

Properties​

NameDescription
BaselineGets the baseline offset from the top of the line.
BoundsGets the bounding rectangle of this line in view coordinates.
ContainingElementGets the node whose content this line belongs to, if any. Selection rendering and vertical navigation group lines by it, so a line that reports none is skipped by both.
EndPositionGets the end position of this line as a lightweight value type.
HasLineBreakGets whether this line ends with a hard line break.
HeightGets the height of this line.
IsValidGets whether this line info is valid (non-empty).
LengthGets the character length of text in this line.
StartPositionGets the start position of this line as a lightweight value type.
WidthGets the width of this line.

Baseline Property​

Gets the baseline offset from the top of the line.

public double Baseline { get; set; }

Bounds Property​

Gets the bounding rectangle of this line in view coordinates.

public Avalonia.Rect Bounds { get; set; }

ContainingElement Property​

Gets the node whose content this line belongs to, if any. Selection rendering and vertical navigation group lines by it, so a line that reports none is skipped by both.

public object ContainingElement { get; set; }

Remarks​

Defaults to so a line written before this member existed still compiles. Such a line is skipped by selection rendering and by vertical navigation, which is the same treatment it received before the member was added.

EndPosition Property​

Gets the end position of this line as a lightweight value type.

public Avalonia.Controls.Documents.TextModel.StaticTextPointer EndPosition { get; set; }

HasLineBreak Property​

Gets whether this line ends with a hard line break.

public bool HasLineBreak { get; set; }

Height Property​

Gets the height of this line.

public double Height { get; set; }

IsValid Property​

Gets whether this line info is valid (non-empty).

public bool IsValid { get; set; }

Length Property​

Gets the character length of text in this line.

public int Length { get; set; }

StartPosition Property​

Gets the start position of this line as a lightweight value type.

public Avalonia.Controls.Documents.TextModel.StaticTextPointer StartPosition { get; set; }

Width Property​

Gets the width of this line.

public double Width { get; set; }

Fields​

NameDescription
EmptyRepresents an empty/invalid text line.

Empty Field​

Represents an empty/invalid text line.

public Avalonia.Controls.Documents.Primitives.TextLineInfo Empty