avalonia

Installation
SKILL.md

Avalonia UI (v12)

Verified against Avalonia 12.1.x. Avalonia 12 requires .NET 8+ (.NET 10 recommended) and makes compiled bindings the default. Pair this skill with desktop-mvvm for view-model patterns.

Core Principles

  1. Compiled bindings everywhere — In Avalonia 12, {Binding} in XAML compiles by default (AvaloniaUseCompiledBindingsByDefault=true). Every view and DataTemplate needs x:DataType. Binding typos become build errors instead of silent blank fields, and there's no reflection, so trimming and AOT keep working.
  2. Views are mapped to view models at compile time — Use typed DataTemplates, or a dictionary-based ViewLocator. The template's reflection ViewLocator (Type.GetType + Activator.CreateInstance) breaks under trimming.
  3. UserControl for composition, TemplatedControl for reusable controls — A lookless templated control can be restyled by consumers. A UserControl is just a reusable chunk of a screen.
  4. Platform services come from TopLevel — Use TopLevel.GetTopLevel(visual) to get the file picker (StorageProvider), Clipboard, and Launcher. These work on Windows, macOS, Linux, and browser. Never reach for Win32/WinForms dialogs.
  5. Build and test on every target OS — Fonts, DPI, window chrome, and file paths differ by platform. A CI matrix (windows/macos/ubuntu) catches problems before users do.

Patterns

Startup with Generic Host

Installs
40
GitHub Stars
801
First Seen
1 day ago