Avalonia.Controls.Documents 12.4.2

Prefix Reserved
dotnet add package Avalonia.Controls.Documents --version 12.4.2
                    
NuGet\Install-Package Avalonia.Controls.Documents -Version 12.4.2
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Avalonia.Controls.Documents" Version="12.4.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Avalonia.Controls.Documents" Version="12.4.2" />
                    
Directory.Packages.props
<PackageReference Include="Avalonia.Controls.Documents" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Avalonia.Controls.Documents --version 12.4.2
                    
#r "nuget: Avalonia.Controls.Documents, 12.4.2"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Avalonia.Controls.Documents@12.4.2
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Avalonia.Controls.Documents&version=12.4.2
                    
Install as a Cake Addin
#tool nuget:?package=Avalonia.Controls.Documents&version=12.4.2
                    
Install as a Cake Tool

Avalonia.Controls.Documents

Core document model library for Avalonia rich text controls. Provides rope-based text storage, a hierarchical document tree, text pointers, undo/redo, and snapshotting.

Features

  • Rope-based text storage (RopeTextStore) with O(log n) insert and delete
  • Document tree model (TextDocument, TextDocumentNode) for structural editing
  • Text pointer API (TextPointer, TextRange) with generation-based invalidation
  • Undo/Redo (UndoManager) with structural snapshot support
  • FlowDocument model with blocks (paragraphs, lists, tables, sections) and inlines
  • Document snapshots for thread-safe background serialization

Quick Start

var document = new FlowDocument();
var paragraph = new Paragraph();
paragraph.Inlines.Add(new Run("Hello, world!"));
document.Blocks.Add(paragraph);

Documentation

See the documentation for more details.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (7)

Showing the top 5 NuGet packages that depend on Avalonia.Controls.Documents:

Package Downloads
Avalonia.Controls.Markdown

Markdown rendering control for Avalonia applications

Avalonia.Controls.Documents.Serialization.Html

HTML serializer for Avalonia.Controls.Documents

Avalonia.Controls.RichTextEditor

Interactive rich text editor control for Avalonia with selection, formatting, and undo/redo support

Avalonia.Controls.Documents.Serialization.Rtf

RTF serializer for Avalonia.Controls.Documents with high-fidelity import and export support

Avalonia.Controls.Documents.Serialization.Docx

DOCX serializer for Avalonia.Controls.Documents based on Open XML

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
12.4.2 12 11/19/2026
12.4.1 1,356 11/5/2026
12.4.0 31,949 10/28/2026
12.3.1 23,061 10/8/2026
12.3.0 8,163 9/11/2026
12.2.3 16,420 8/20/2026
12.2.2 35,999 7/31/2026
12.2.1 716 7/29/2026
12.2.0 10,332 7/23/2026
12.1.5 9,405 6/29/2026
12.1.4 11,966 6/22/2026
12.1.3 845 6/9/2026
12.1.2 865 6/2/2026
12.1.1 1,575 5/14/2026
12.1.0 4,316 5/12/2026

## 12.4.2

### Behavioural changes
- The text formatting set on a `FlowDocument` (`FontFamily`, `FontSize`, `FontWeight`, `FontStyle`, `FontStretch`, `Foreground`, `Background`) is the document's default text formatting in the model (`TextDocument.DefaultTextFormatting`), so every snapshot carries it on its root and serializers see it. It lived on the facade only, so a document's font never reached a saved file. A `FlowDocument` over a loaded or model-first `TextDocument` presents the model's values, so a document read with a default font shows in it. A value the document only inherits from the control hosting it is not the document's and stays out. Setting `TextDocument.DefaultTextFormatting` while a `FlowDocument` presents the document replaces the facade's values, a value set on the `FlowDocument` earlier among them, so a view showing the document re-renders in the new defaults.

### Fixes
- Character formatting passes a preformatted block by, as a paste into one already arrives as plain text. A Markdown code block took bold, a font size or any other character formatting applied to a range across it or at a caret inside it, and lost it on saving, since a fenced code block cannot carry it. Applying or toggling a character property on a range skips such blocks, and at a caret inside one it neither formats nor springloads. This holds for every block kind registered with `NodeKindFlags.Preformatted`.
- A paste with the caret in an empty table cell or an empty list item goes into that cell or item. A table, list or section without any text was taken for an empty line: when it was the document's only block the paste replaced it, and otherwise the pasted content landed above it. An empty preformatted block takes the paste as its own text the same way.
- A paragraph's first-line indent (`Block.TextIndent`, read from RTF `\fi`, DOCX `w:firstLine`/`w:hanging` and XAML) is laid out: the first line starts that far from the paragraph edge, a negative value hangs it out to the left, and the lines after a wrap or a line break start at the edge. The indent was kept in the document and written back out but the layout always used 0. Drawing it needs an Avalonia version whose text formatter applies `TextParagraphProperties.Indent` (AvaloniaUI/Avalonia#22870); on earlier versions the paragraph lays out as before.
- The text after an embedded object that nothing draws is laid out. A `RichInlineUIContainer` without a child ended its paragraph's layout, so the rest of the paragraph never showed, though it stayed in the document. Such an object now keeps its place in the line and paints nothing.