avalonia
Installation
SKILL.md
Avalonia
Workflow
- Inspect the SDK, target frameworks, Avalonia package versions,
.axamlfiles, entrypoint, and supported OS/RIDs. Keep Avalonia packages on one compatible version. Use the Avalonia 12 docs for 12 and the Avalonia 11 docs for 11; do not copy 12-only APIs into 11. - Keep
Program.BuildAvaloniaApp,App.axaml, views, view models, and domain/services separate. Desktop hosts useStartWithClassicDesktopLifetimeand createMainWindowinOnFrameworkInitializationCompleted; single-view targets require their own lifetime. The previewer can have no application lifetime. - Use typed compiled bindings and explicit binding modes.
x:DataTypedescribes the binding type; it does not set the runtimeDataContext. Avalonia 12 enables compiled bindings by default; explicitly enable them on 11. Read references/bindings-and-controls.md for templates, properties, resources, and command patterns. - Use
CommunityToolkit.Mvvmfor observable state and commands when appropriate. Prefer cancellable asynchronous service operations, surface errors, and marshal background updates to the UI dispatcher. Keep services independent of controls. - Choose
StyledPropertyfor styleable/animatable values andDirectPropertyfor backed state without style precedence. UseDataTemplateto display data andControlTemplate/ControlThemeto change a control's visual structure. UseUserControlfor application composition,TemplatedControlfor reusable skinnable controls, and custom rendering only when needed. - Validate native integrations, dialogs, resources, shutdown, DPI, accessibility, and packaging on each supported platform. Read references/platforms-and-publishing.md before trimming or Native AOT. Read the documentation map only for the selected topic.