AvaloniaEdit
11.1.0
Este proyecto es un puerto de Avalonedit, un editor de texto basado en WPF para Avalonia.
Avaloniaedit admite características como:
¡Y muchos, muchos más!
Avaloniaedit actualmente consta de 2 paquetes
<PackageReference Include="Avalonia.AvaloniaEdit" Version="xyzt" /><Application.Styles> en su App.xaml :0.10.xy , incluya <StyleInclude Source="avares://AvaloniaEdit/AvaloniaEdit.xaml" />11.xy , incluya <StyleInclude Source="avares://AvaloniaEdit/Themes/Fluent/AvaloniaEdit.xaml" />< 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 >Puede ver la aplicación de demostración como referencia.
En primer lugar, si desea usar gramáticas compatibles con TextmatesHarp, debe instalar los siguientes paquetes:
Alternativamente, si desea admitir sus propias gramáticas, solo necesita instalar el paquete Avaloniaedit.TextMate e implementar la interfaz IREGistryOptions, esa es actualmente la forma más fácil en caso de que desee usar Avaloniaedit con el conjunto de gramáticas diferentes de las gramias de texto de texto internos.
//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 ) ) ; 