Architecture
Layers
- UI: Avalonia Views and XAML layouts only
- Presentation: ViewModels with state, commands, and reactive composition
- Domain: document models, layout, rendering, parsing, validation
- Infrastructure: file system, persistence, external integrations
MVVM and ReactiveUI
- Views are passive and contain no code-behind logic beyond
InitializeComponent() - All inputs flow through bindings, commands, and behaviors
- ViewModels inherit from
ReactiveObject - Commands use
ReactiveCommand - Derived state uses
WhenAnyValueandObservableAsPropertyHelper - Dialogs and user flows use
Interaction<TIn, TOut>
Avalonia Practices
- XAML for visuals and layout
- Compiled bindings only with explicit
x:DataType - Use
DataTemplateor a customViewLocatorfor view lookup - Prefer
DirectPropertyunless styling requiresStyledProperty
Performance Guidelines
- Prefer allocation-free APIs like
Span<T>,ReadOnlySpan<T>, andArrayPool<T> - Avoid LINQ in hot paths
- Profile before and after performance changes
Next: Build and Test