# AvaloniaEdit brings a real text editor to Avalonia, styles included

> AvaloniaEdit is a C# port of the WPF editor AvalonEdit for the Avalonia UI framework, offering syntax highlighting, folding, completion, multi-caret and line virtualization in two NuGet packages. It is the pragmatic choice when a cross-platform desktop app needs an editable code or text surface, and its rough edges are the required style include and a 12.0 release candidate still in the pipeline.

**AvaloniaUI/AvaloniaEdit** — Avalonia-based text editor (port of AvalonEdit)

- Repository: https://github.com/AvaloniaUI/AvaloniaEdit
- Stars: 1,142 · Forks: 237
- Language: C#
- License: MIT
- Published: 2026-10-19 · Updated: 2026-10-19 · Language: en
- Canonical page: https://hysenlabs.com/projects/avaloniaui-avaloniaedit

## A port of AvalonEdit, which means the WPF design is inherited

AvaloniaEdit is not a new editor written from scratch. It is a port of AvalonEdit, the WPF-based text editor, onto the Avalonia UI framework. That ancestry is a feature and a constraint at the same time. The feature is that a great deal of editor behaviour, syntax highlighting, folding, completion, line numbers, word wrapping, multi-caret editing, adornments in the margin, hyperlinks, line virtualization, is already designed and battle-tested, and the port means you get it on macOS, Linux and Windows from one Avalonia codebase. The constraint is that the port is a translation, not a reinterpretation, so some of the shape of the original comes through in the control names and the package layout. The audience is developers building Avalonia applications who need a text editing surface with real editor features, as opposed to a plain text input for a form field.

## Two packages, and one of them is optional

The distribution is deliberately split. Avalonia.AvaloniaEdit is the well-known package that contains the text editor itself, and AvaloniaEdit.TextMate is a separate package that adds TextMate integration. The split matters because TextMate is what gives you syntax highlighting: TextMateSharp grammars and themes, and the separate package is what installs that machinery. If you only need an editor with no colouring, the first package is enough. If you want highlighting for the grammars that TextMateSharp supports, the README tells you to install AvaloniaEdit.TextMate together with TextMateSharp.Grammars. If you want to use your own grammars instead, you install only AvaloniaEdit.TextMate and implement the IRegistryOptions interface, which the documentation describes as the easiest route when the grammars you need differ from the bundled set. That is a good sign of a library that expects to be extended, and it is also where you will meet the code.

## The editor renders nothing until you include the styles

Setting up an editor takes four steps, and the third one is the one people miss. You create an empty Avalonia application, add the NuGet reference:

```xml
<PackageReference Include="Avalonia.AvaloniaEdit" Version="x.y.z.t" />
```

then you include the required styles in your Application.Styles in App.xaml:

```xml
<Application xmlns="https://github.com/avaloniaui"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             x:Class="MyAvaloniaApplication.App"
             RequestedThemeVariant="Default">
  <Application.Styles>
    <FluentTheme />

    <!-- AvaloniaEdit styles (required!) -->
    <StyleInclude Source="avares://AvaloniaEdit/Themes/Fluent/AvaloniaEdit.xaml" />

  </Application.Styles>
</Application>
```

Only then do you place the control in your window:

```xml
<Window xmlns="https://github.com/avaloniaui"
        ...
        xmlns:AvaloniaEdit="clr-namespace:AvaloniaEdit;assembly=AvaloniaEdit"
        ...>
  ...
  <AvaloniaEdit:TextEditor Text="Hello AvaloniaEdit!"
                           ShowLineNumbers="True"
                           FontFamily="Cascadia Code,Consolas,Menlo,Monospace"/>
  ...
</Window>
```

The comment in the styles block marks them as required, and the reason is not a mystery: the control carries no built-in template, so without the style include the editor has nothing to draw with. A demo application under src/AvaloniaEdit.Demo is offered as a working reference.

## TextMate setup is a registry options object and three calls

Highlighting is set up in code. You find the editor in your view, build a registry options object with the theme you want, and install TextMate into the editor:

```csharp
var _textEditor = this.FindControl<TextEditor>("Editor");
var _registryOptions = new RegistryOptions(ThemeName.DarkPlus);
var _textMateInstallation = _textEditor.InstallTextMate(_registryOptions);
```

The last step picks the language by file extension and applies the matching grammar:

```csharp
_textMateInstallation.SetGrammar(_registryOptions.GetScopeByLanguageId(_registryOptions.GetLanguageByExtension(".cs").Id));
```

The shape of this API is worth noting, because it is the part you will extend. There is a registry of options that knows about themes, languages and scopes, an installation object that binds TextMate to a specific editor instance, and a grammar chosen by language id. A theme name such as DarkPlus comes from the TextMateSharp side, and a custom grammar set means supplying your own IRegistryOptions implementation. The project describes itself as fully customizable and extensible, and this is the shape of that claim.

## Line virtualization and multi-caret are the features that justify a component

The feature list is long, and a few entries separate a real editor from a text box. Line virtualization means the control only materialises the visible part of a large document, which is what keeps a multi-megabyte log or a generated file scrollable. Multi-caret edition allows several insertion points at once, which no standard input control offers. Intra-column adornments let you place markers in the margin next to a line, the mechanism that a debugger or a linter integration needs. Code folding, code completion, line numeration, display of whitespace, end of line characters and tabs, word wrapping, and scrolling below the document for the area past the last line round out the list, along with hyperlinks. The set is coherent because it comes from an editor that was designed to be a general purpose code and text editor rather than a form field with extras.

## 12.0 is still a release candidate and 11.4 is the settled line

The release history shows a fast 11.4 line and a slower 12.0 line. Version 11.4.0 was published on 2026-02-03 and 11.4.1 on 2026-02-05, while 12.0.0-rc1 appeared on 2026-03-23 and has not been followed by a final in the list. The last push was on 2026-08-28, so the tree continues to receive work, and the repository carries an azure-pipelines.yml, a solution file and central build properties, which is the shape of a project with a continuous integration pipeline behind it. The licence is MIT, which is the permissive choice that lets you embed the control in a commercial desktop application without obligations beyond attribution and the licence notice. The practical decision for a consumer is the one every release candidate forces: pin 11.4.x if you cannot absorb a breaking change in your own build, and treat 12.0.0-rc1 as something to test rather than something to depend on.

## When a text box is the better answer

AvaloniaEdit is the wrong tool in a few ordinary situations. If your input is a name or a comment, a plain text box is smaller, faster and does not need the style include. If your application is WPF and Windows only, then the original AvalonEdit is the direct path and this port adds a framework hop for nothing. If your editor needs features the port did not carry over, you will find that out at integration time, because the port tracks the original's design rather than the platform's, and the documentation in the repository is a getting started page plus a feature list, not a complete API guide, so gap discovery is on you. The difference in approach between the alternatives is the one that matters: a plain text box gives you the platform's input handling and nothing else, while AvalonEdit gives you a document model, an editor that understands the document, and an extension surface, at the price of a component with its own styling contract, its own package split and its own release cadence.

## Conclusion

AvaloniaEdit fits a desktop app that runs on several operating systems through Avalonia and needs more than a text box, especially when syntax highlighting for many languages is wanted without wiring up an editor yourself. It does not fit a simple data entry form, and it is a poor fit for a project that cannot accept a component whose WPF ancestry shows through the API, or a dependency currently sitting on a release candidate. Before adopting it, add the AvaloniaEdit Fluent style include to your application styles and confirm your editor renders at all, since without that include nothing appears, and decide whether to start on 12.0.0-rc1 or stay on the 11.4 line that shipped in February 2026.

## FAQ

### Which NuGet packages does AvaloniaEdit ship?

Two. Avalonia.AvaloniaEdit contains the text editor itself, and AvaloniaEdit.TextMate adds the TextMate integration for syntax highlighting. The project is distributed on NuGet as Avalonia.AvaloniaEdit.

### Why does my AvaloniaEdit editor not appear in the window?

The AvaloniaEdit styles have to be included in your Application.Styles in App.xaml, using the style include for avares://AvaloniaEdit/Themes/Fluent/AvaloniaEdit.xaml. The README marks those styles as required.

### How do I add syntax highlighting to AvaloniaEdit?

Install AvaloniaEdit.TextMate, plus TextMateSharp.Grammars for the bundled grammar set, then install TextMate into the editor with InstallTextMate and call SetGrammar with the scope for the language you want. You can supply your own grammars by implementing IRegistryOptions instead.

### What licence is AvaloniaEdit released under?

MIT, with a LICENSE file in the repository root. The latest stable line is 11.4.x, with 11.4.1 published on 2026-02-05, and 12.0.0-rc1 published on 2026-03-23.

## Sources

- [AvaloniaUI/AvaloniaEdit on GitHub](https://github.com/AvaloniaUI/AvaloniaEdit)
- [Issues](https://github.com/AvaloniaUI/AvaloniaEdit/issues)
- [License: MIT](https://github.com/AvaloniaUI/AvaloniaEdit/blob/master/LICENSE)
- [README](https://github.com/AvaloniaUI/AvaloniaEdit/blob/master/README.md)
- [Releases](https://github.com/AvaloniaUI/AvaloniaEdit/releases)

---

Hysen Labs editorial analysis, written from the project's own repository and release notes. Cite the canonical page: https://hysenlabs.com/projects/avaloniaui-avaloniaedit
