Avalonia Field Guide
About

Avalonia 12.2 · .NET 10 · Linux, macOS, Windows

Avalonia, from an empty window
to a shipped app.

16 lessons built around one real codebase. Every screenshot on this site was rendered by the sample app itself, and the portal refuses to build if a lesson references a file or a screenshot that doesn't exist.

Lessons
16
Modules
4
Reading
~8 h
Every sample
built + rendered

Your progress

0 of 16 lessons complete.

The curriculum

Foundations

A window, some XAML, and the rules that keep it honest.

4 lessons · ~95 min
  1. 01One window, three filesProgram starts the app, App owns the lifetime, MainWindow is a control tree. Everything else is built on these three.20 min
  2. 02Bindings the compiler can seeXAML maps elements to types and attributes to properties. In Avalonia 12, bindings compile by default — a typo becomes a build error.25 min
  3. 03Star sizing, and nothing elseLayout is measure and arrange. Grid star units share what is left, and one alignment mistake collapses them to nothing.25 min
  4. 04Lists that stay in syncItemsSource, ItemTemplate, and SelectedItem are the whole API. ObservableCollection tells the control what changed.25 min

Application architecture

View models, async, forms, navigation, and dialogs.

5 lessons · ~145 min
  1. 01Commands, not click handlersProperties for state, commands for intent, and a computed total that recalculates itself. No control is touched from code-behind.30 min
  2. 02Work that doesn't freeze the windowAsync commands keep the UI thread free. Cancellation is a button, not a dead process, and the busy state is data.30 min
  3. 03Validation that blocks the buttonErrors belong to the view model. INotifyDataErrorInfo plus CanExecute is the whole validation story.30 min
  4. 04Two screens, one ContentControlNavigation is a view model swap. One host control, a current page, and a back command — no new windows.25 min
  5. 05A dialog is a window with a resultShowDialog<T> blocks the caller until the child closes and hands back a value. Files go through IStorageProvider, never a path you guessed.30 min

Craft

Themes, templated controls, custom drawing, and motion.

4 lessons · ~115 min
  1. 01Tokens, scopes, and two themesName the role, not the colour. ThemeDictionaries answer for light and dark, and a ThemeVariantScope can answer differently for part of the page.30 min
  2. 02A control with a contract, not a copyA TemplatedControl publishes properties and behaviour; a ControlTheme owns the pixels. One theme edit restyles every pill in the app.30 min
  3. 03When a template isn't the answerGeometry belongs in Render, not in a tree of borders. AffectsRender ties the drawing to the data.30 min
  4. 04Transitions for state, animations for attentionA transition animates the property change that already happened. A keyframe animation runs on a clock. Neither belongs in a view model.25 min

Production

Performance, testing, and getting it onto someone's machine.

3 lessons · ~100 min
  1. 01Ten thousand rows, thirty controlsA virtualizing panel creates containers for the viewport, not for the data. Count them instead of trusting the demo.30 min
  2. 02Proof, not vibesA headless harness boots the real app, renders every page, and asserts the things a screenshot cannot show.35 min
  3. 03From dotnet run to someone else's desktopPublishing is a checklist. Pick a runtime story, keep trimming honest, add the desktop entry, and test the artifact on a machine that never saw the SDK.35 min

How the content is kept honest

A tutorial that no longer compiles is worse than no tutorial. Three checks run before this site is published.

  1. It compiles

    All projects build with TreatWarningsAsErrors, against the same Avalonia version the lessons name.

  2. It renders

    A headless harness opens every lesson page at 1280×800, light and dark, and saves the PNG. The build reads each PNG header and fails if the dimensions drift.

  3. It resolves

    Every [[file:…]] listing is pulled from the real source at build time, and every screenshot reference must exist.

The harness lives in src/CourseApp.Verify and tools/ContentBuild. What is and isn't automated →