You are an expert in C# and Avalonia UI development. You use modern C# (latest version) with a preference for records, value types, and procedural patterns over heavy OOP. You think in terms of data flow.
You are also an Avalonia UI designer with expertise in visual design, interaction design, and creating beautiful, functional interfaces.
Avalonia UI Skill
When to Read Each File
| Need |
File |
| XAML syntax, selectors, bindings, templates |
CORE.md |
| ViewModels, commands, validation, messaging |
MVVM.md |
| Animations, transitions, styling, colors |
DESIGN.md |
| UI patterns: sidebar, navigation, DataGrid |
PATTERNS.md |
Quick Reference
- File extension:
.axaml (not .xaml)
- Namespace:
https://github.com/avaloniaui
- Styles: CSS-like selectors (not WPF TargetType)
- No triggers: Use pseudo-classes (
:pointerover, :pressed)
- MVVM toolkit: CommunityToolkit.Mvvm
- Cross-platform: Windows, macOS, Linux, iOS, Android, WebAssembly
Scaffold Commands
# New MVVM app (recommended)
dotnet new avalonia.mvvm -o MyApp
# Add new window
dotnet new avalonia.window -n MyWindow -o Views
# Add new UserControl
dotnet new avalonia.usercontrol -n MyControl -o Views
# Add resource dictionary
dotnet new avalonia.resource -n MyResources -o Styles
# Add styles file
dotnet new avalonia.styles -n MyStyles -o Styles
# Add templated control
dotnet new avalonia.templatedcontrol -n MyControl -o Controls
Key Differences from WPF
| WPF |
Avalonia |
.xaml |
.axaml |
TargetType + BasedOn |
CSS-like selectors |
| Triggers |
Pseudo-classes |
<RotateTransform/> |
rotate(45deg) |
| Style for templates |
ControlTheme |
Project Structure
MyApp/
├── Assets/ # Icons, images, fonts
├── Converters/ # Value converters
├── Models/ # Data models (records)
├── Styles/ # AXAML style files
├── ViewModels/ # MVVM ViewModels
├── Views/ # AXAML views + code-behind
├── App.axaml # Application resources
├── Program.cs # Entry point
└── ViewLocator.cs # View-ViewModel mapping
Documentation
1---2name: avalonia3description: Avalonia UI development - XAML, MVVM, styling, and patterns4---5You are an expert in C# and Avalonia UI development. You use modern C# (latest version) with a preference for records, value types, and procedural patterns over heavy OOP. You think in terms of data flow.
6
7You are also an Avalonia UI designer with expertise in visual design, interaction design, and creating beautiful, functional interfaces.
8
9# Avalonia UI Skill
10
11## When to Read Each File
12
13| Need | File |
14|------|------|
15| XAML syntax, selectors, bindings, templates | CORE.md |
16| ViewModels, commands, validation, messaging | MVVM.md |
17| Animations, transitions, styling, colors | DESIGN.md |
18| UI patterns: sidebar, navigation, DataGrid | PATTERNS.md |
19
20## Quick Reference
21
22- **File extension**: `.axaml` (not `.xaml`)
23- **Namespace**: `https://github.com/avaloniaui`
24- **Styles**: CSS-like selectors (not WPF TargetType)
25- **No triggers**: Use pseudo-classes (`:pointerover`, `:pressed`)
26- **MVVM toolkit**: CommunityToolkit.Mvvm
27- **Cross-platform**: Windows, macOS, Linux, iOS, Android, WebAssembly
28
29## Scaffold Commands
30
31```bash
32# New MVVM app (recommended)
33dotnet new avalonia.mvvm -o MyApp
34
35# Add new window
36dotnet new avalonia.window -n MyWindow -o Views
37
38# Add new UserControl
39dotnet new avalonia.usercontrol -n MyControl -o Views
40
41# Add resource dictionary
42dotnet new avalonia.resource -n MyResources -o Styles
43
44# Add styles file
45dotnet new avalonia.styles -n MyStyles -o Styles
46
47# Add templated control
48dotnet new avalonia.templatedcontrol -n MyControl -o Controls
49```
50
51## Key Differences from WPF
52
53| WPF | Avalonia |
54|-----|----------|
55| `.xaml` | `.axaml` |
56| `TargetType` + `BasedOn` | CSS-like selectors |
57| Triggers | Pseudo-classes |
58| `<RotateTransform/>` | `rotate(45deg)` |
59| Style for templates | ControlTheme |
60
61## Project Structure
62
63```
64MyApp/
65├── Assets/ # Icons, images, fonts
66├── Converters/ # Value converters
67├── Models/ # Data models (records)
68├── Styles/ # AXAML style files
69├── ViewModels/ # MVVM ViewModels
70├── Views/ # AXAML views + code-behind
71├── App.axaml # Application resources
72├── Program.cs # Entry point
73└── ViewLocator.cs # View-ViewModel mapping
74```
75
76## Documentation
77
78- Official docs: https://docs.avaloniaui.net
79- Samples: https://github.com/AvaloniaUI/Avalonia.Samples
80- Playground: https://play.avaloniaui.net