• Stars
    star
    716
  • Rank 63,241 (Top 2 %)
  • Language
    C#
  • License
    MIT License
  • Created over 7 years ago
  • Updated 4 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Avalonia-based text editor (port of AvalonEdit)

downloads Current stable version

AvaloniaEdit

This project is a port of AvalonEdit, a WPF-based text editor for Avalonia.

AvaloniaEdit supports features like:

  • Syntax highlighting using TextMate grammars and themes.
  • Code folding.
  • Code completion.
  • Fully customizable and extensible.
  • Line numeration.
  • Display whitespaces EOLs and tabs.
  • Line virtualization.
  • Multi-caret edition.
  • Intra-column adornments.
  • Word wrapping.
  • Scrolling below document.
  • Hyperlinks.

and many,many more!

AvaloniaEdit currently consists of 2 packages

Getting started

How to set up a new project that displays an AvaloniaEdit editor?

  • Create an empty Avalonia application.
  • Add a the nuget reference to the latest version: <PackageReference Include="Avalonia.AvaloniaEdit" Version="x.y.z.t" />
  • Include the needed styles into your <Application.Styles> in your App.xaml:
    • If you're using 0.10.x.y based versions, include <StyleInclude Source="avares://AvaloniaEdit/AvaloniaEdit.xaml" />
    • If you're 11.x.y based versions, include <StyleInclude Source="avares://AvaloniaEdit/Themes/Fluent/AvaloniaEdit.xaml" />
  • Finally, add the AvaloniaEdit editor into your window:
<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>

You can see the Demo Application as a reference.

How to set up TextMate theme and syntax highlighting for my project?

First of all, if you want to use grammars supported by TextMateSharp, should install the following packages:

Alternatively, if you want to support your own grammars, you just need to install the AvaloniaEdit.TextMate package, and implement IRegistryOptions interface, that's currently the easiest way in case you want to use AvaloniaEdit with the set of grammars different from in-bundled TextMateSharp.Grammars.

//First of all you need to have a reference for your TextEditor for it to be used inside AvaloniaEdit.TextMate project.
var _textEditor = this.FindControl<TextEditor>("Editor");

//Here we initialize RegistryOptions with the theme we want to use.
var  _registryOptions = new RegistryOptions(ThemeName.DarkPlus);

//Initial setup of TextMate.
var _textMateInstallation = _textEditor.InstallTextMate(_registryOptions);

//Here we are getting the language by the extension and right after that we are initializing grammar with this language.
//And that's all πŸ˜€, you are ready to use AvaloniaEdit with syntax highlighting!
_textMateInstallation.SetGrammar(_registryOptions.GetScopeByLanguageId(_registryOptions.GetLanguageByExtension(".cs").Id));

avaloniaedit-demo

More Repositories

1

Avalonia

Develop Desktop, Embedded, Mobile and WebAssembly apps with C# and XAML. The most popular .NET UI client technology
C#
25,320
star
2

Avalonia.Samples

Avalonia.Samples aims to provide some minimal samples focusing on a particular issue at a time. This should help getting new users started.
C#
570
star
3

Citrus.Avalonia

Modern styles for Avalonia controls.
C#
542
star
4

avalonia-dotnet-templates

Avalonia Templates for `dotnet new`
C#
478
star
5

AvaloniaVS

Visual Studio Extension for Avalonia
C#
414
star
6

Live.Avalonia

In-app live reload for Avalonia applications.
C#
402
star
7

Avalonia.Xaml.Behaviors

Port of Windows UWP Xaml Behaviors for Avalonia Xaml.
C#
376
star
8

Avalonia.Markup.Declarative

Provides helpers for declarative ui in C#
C#
322
star
9

Avalonia.Controls.TreeDataGrid

A combined TreeView/DataGrid for Avalonia.
C#
268
star
10

Avalonia.Labs

Experimental Controls for Avalonia
C#
167
star
11

XamlControlsGallery

C#
159
star
12

AvaloniaMauiHybrid

Brings templated controls, pixel perfect rendering, animations, styling and composition to Maui
C#
152
star
13

AvaloniaUI.QuickGuides

C#
136
star
14

Avalonia.HtmlRenderer

Avalonia front-end for the HtmlRenderer project.
C#
112
star
15

AvaloniaVSCode

Visual Studio Code Extension for Avalonia UI
TypeScript
97
star
16

Avalonia.GIF

GIF image renderer and player for Avalonia UI Framework
C#
91
star
17

Avalonia.NameGenerator

Generates x:Name refs to Avalonia XAML controls.
C#
85
star
18

AvaloniaAutoGrid

C#
78
star
19

Avalonia.Essentials

Essential cross platform APIs for your mobile apps.
C#
65
star
20

Solitaire

C#
64
star
21

Wordle-onia

C#
60
star
22

ControlCatalogStandalone

C#
57
star
23

XamlPlayground

Avalonia Xaml Playground
C#
56
star
24

avalonia-docs

JavaScript
55
star
25

Documentation

AvaloniaUI documentation page source code
53
star
26

Avalonia.VSCodeExtension

This is an experimental VSCode extension. Don't expect it to work.
C#
50
star
27

Avalonia.MusicStore

C#
47
star
28

Avalonia-VSCode-Extension

An awesome extension for Visual Studio Code.
44
star
29

Avalonia.Lottie

Lottie/Bodymovin renderer and player for Avalonia UI Framework.
C#
29
star
30

Avalonia.AxamlAutoCompletion

C#
15
star
31

skiabuild

Makefile
6
star
32

MusicStoreTutorial

C#
6
star
33

Avalonia.TagsAndIdentation

TypeScript
5
star
34

NodeEditor

CSS
4
star
35

Avalonia.WebCam

Experimental cross-platform webcam interface for Avalonia UI Framework.
C#
3
star
36

Avalonia.Toolkit

2
star
37

.github

2
star