Skip to main content

TextChangeEventArgs Class

Definition​

Assembly:Avalonia.Controls.Documents
Package:Avalonia.Controls.Documents
public class TextChangeEventArgs

Inheritance: EventArgs -> TextChangeEventArgs

Properties​

NameDescription
InsertedTextGets the text at [Avalonia.Controls.Documents.TextModel.TextChangeEventArgs.Offset, Avalonia.Controls.Documents.TextModel.TextChangeEventArgs.Offset + Avalonia.Controls.Documents.TextModel.TextChangeEventArgs.NewLength) right after the change. Empty for pure deletions.
KindGets the kind of change (Insert, Delete, or Replace).
NewLengthGets the length of text that was inserted (0 for pure deletions).
OffsetGets the offset where the change occurred.
OldLengthGets the length of text that was deleted (0 for pure insertions).

InsertedText Property​

Gets the text at [Avalonia.Controls.Documents.TextModel.TextChangeEventArgs.Offset, Avalonia.Controls.Documents.TextModel.TextChangeEventArgs.Offset + Avalonia.Controls.Documents.TextModel.TextChangeEventArgs.NewLength) right after the change. Empty for pure deletions.

public ReadOnlyMemory<char> InsertedText { get; set; }

Remarks​

The event holds an immutable reference to that text, not a copy; reading this property returns a zero-copy view when the text lies in one storage chunk and copies it on first read otherwise. Later edits do not change it.

Kind Property​

Gets the kind of change (Insert, Delete, or Replace).

public Avalonia.Controls.Documents.TextModel.DocumentChangeKind Kind { get; set; }

NewLength Property​

Gets the length of text that was inserted (0 for pure deletions).

public int NewLength { get; set; }

Offset Property​

Gets the offset where the change occurred.

public int Offset { get; set; }

OldLength Property​

Gets the length of text that was deleted (0 for pure insertions).

public int OldLength { get; set; }