AvalonEdit
Welcome

AvalonEdit is a WPF-based extensible text editor.

While the WPF RichTextBox is quite powerful, you quickly run into its limits when trying to use it as a code editor: it's hard to write efficient syntax highlighting for it, and you cannot really implement features like code folding with the standard RichTextBox.

The problem is: the RichTextBox edits a rich document. In contrast, AvalonEdit simply edits text.

However, AvalonEdit offers lots of possibilities on how the text document is displayed - so it is much more suitable for a code editor where things like the text color are not controlled by the user, but instead depend on the text (syntax highlighting).

AvalonEdit was written for the SharpDevelop IDE. It replaces our old Windows Forms-based text editor (ICSharpCode.TextEditor).

Usage

The main class of the editor is ICSharpCode.AvalonEdit..::..TextEditor. You can use it similar to a normal WPF TextBox:

Xml Copy imageCopy
<avalonEdit:TextEditor
    xmlns:avalonEdit="http://icsharpcode.net/sharpdevelop/avalonedit"
    Name="textEditor"
    SyntaxHighlighting="C#"
    FontFamily="Consolas"
    FontSize="10pt"/>
System requirements

There are two versions of AvalonEdit - the normal one requires .NET Framework 4.0 or higher; but we also offer a modified version for .NET 3.5 SP1. For compiling AvalonEdit, you will need a C# 4.0 compiler (SharpDevelop 4.x or Visual Studio 2010).

AvalonEdit requires FullTrust and will not run as XBAP.

See Also