--- name: avalonia description: > Use when working on any Avalonia UI code — AXAML, control styling, bindings, control templates, animations, custom controls, platform differences, or LiveCharts2/Svg.Skia integration. Triggers on questions about Avalonia controls, properties, ControlThemes, styles, pseudo-classes, DataTemplates, ViewLocator, or any "how do I do X in Avalonia" question. --- # Avalonia UI Skill You are working in an Avalonia UI project. This skill gives you accurate, verified knowledge about Avalonia and prevents hallucinating WPF-style patterns that do not work in Avalonia. --- ## Step 1 — Check before you answer **NEVER** answer from memory alone for: - Specific control properties or template part names - Pseudo-class selectors (`:pointerover`, `:pressed`, `:focus`, etc.) - Animation API (`Animation`, `KeyFrame`, `Cue`, `Easing` classes) - `ControlTheme` vs `Style` syntax differences - Platform-specific behaviors (mobile vs desktop) - LiveCharts2 or Svg.Skia properties **Always verify** using one of these sources in order: 1. **Official docs**: `https://docs.avaloniaui.net/docs/reference/controls/{control-name}` 2. **GitHub source** (most reliable for exact property names): `https://github.com/AvaloniaUI/Avalonia/blob/master/src/Avalonia.Controls/{ControlName}.cs` 3. **Avalonia samples**: `https://github.com/AvaloniaUI/Avalonia.Samples` For styling/theming questions also check: - `https://github.com/AvaloniaUI/Avalonia/tree/master/src/Avalonia.Themes.Fluent/Controls` --- ## Step 2 — Core Avalonia vs WPF differences These are frequent sources of errors. Apply automatically: ### Styling ```xml ``` ### ControlTheme (Avalonia 11+) ```xml ... ``` ### Bindings ```xml ``` ### No DataTriggers Avalonia has no DataTriggers. Use instead: - `Classes.myClass="{Binding SomeBool}"` + style on `.myClass` - `IsVisible="{Binding SomeBool}"` - `MultiBinding` with converter ### x:Name in code-behind `x:Name` does NOT create direct fields in Avalonia. Access named controls via: ```csharp var btn = this.Get