Skip to content

Commit 2f3fd57

Browse files
authored
Update README.md
Add some documentation about how to include getting started creating a new AvaloniaEdit application
1 parent daf4320 commit 2f3fd57

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

README.md

+24
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,30 @@ AvaloniaEdit currently consists of 2 packages
2525
* [Avalonia.AvaloniaEdit](https://www.nuget.org/packages/Avalonia.AvaloniaEdit) well-known package that incudes text editor itself.
2626
* [AvaloniaEdit.TextMate](https://www.nuget.org/packages/AvaloniaEdit.TextMate/) package that adds TextMate integration to the AvaloniaEdit.
2727

28+
## Getting started
29+
30+
### How to set up a new project that displays an AvaloniaEdit editor?
31+
* Create an [empty Avalonia application](https://docs.avaloniaui.net/docs/getting-started).
32+
* Add a the [nuget reference](https://www.nuget.org/packages/Avalonia.AvaloniaEdit/#versions-body-tab) to the latest version:
33+
`<PackageReference Include="Avalonia.AvaloniaEdit" Version="x.y.z.t" />`
34+
* Include the *needed styles* into your `<Application.Styles>` in your `App.xaml`:
35+
* If you're using `0.10.x.y` based versions, include `<StyleInclude Source="avares://AvaloniaEdit/AvaloniaEdit.xaml" />`
36+
* If you're `11.x.y` based versions, include `<StyleInclude Source="avares://AvaloniaEdit/Themes/Fluent/AvaloniaEdit.xaml" />`
37+
* Finally, add the AvaloniaEdit editor into your window:
38+
```xaml
39+
<Window xmlns="https://github.com/avaloniaui"
40+
...
41+
xmlns:AvaloniaEdit="clr-namespace:AvaloniaEdit;assembly=AvaloniaEdit"
42+
...>
43+
...
44+
<AvaloniaEdit:TextEditor Text="Hello AvaloniaEdit!"
45+
ShowLineNumbers="True"
46+
FontFamily="Cascadia Code,Consolas,Menlo,Monospace"/>
47+
...
48+
</Window>
49+
```
50+
You can see the [Demo Application](https://github.com/AvaloniaUI/AvaloniaEdit/tree/master/src/AvaloniaEdit.Demo) as a reference.
51+
2852
### How to set up TextMate theme and syntax highlighting for my project?
2953
First of all, if you want to use grammars supported by [TextMateSharp](https://github.com/danipen/TextMateSharp), should install the following packages:
3054
- [AvaloniaEdit.TextMate](https://www.nuget.org/packages/AvaloniaEdit.TextMate/)

0 commit comments

Comments
 (0)