$38
You are building a cross-platform desktop application with Avalonia. Read the relevant reference docs below based on what you're building. Always use compiled bindings and always set up DI properly — these are the foundation of a well-structured Avalonia app.
Desktop apps have different constraints than web or mobile. Embrace keyboard-first interaction, higher information density, and platform integration. Support light/dark mode from day one. Use the Fluent theme as your starting point and customize from there. See 12-desktop-ui-design.md for navigation patterns, typography, spacing, and layout guidance specific to desktop.
If bindings don't work, CHECK COMPILED BINDINGS FIRST — ensure is set on the view and properties exist on the ViewModel.
x:DataTypeRead the relevant docs based on your task:
<AvaloniaUseCompiledBindingsByDefault>true</AvaloniaUseCompiledBindingsByDefault> in the project. Always set x:DataType on views. Compiled bindings catch errors at build time and are required for AOT.async/await for all I/O. Use Task.Run() for CPU-bound work. Never call .Result or .Wait() from the UI thread.ItemsRepeater or ListBox with virtualization for 50+ items. Never use StackPanel inside ScrollViewer for large collections.DataTrigger or EventTrigger in Avalonia. Use style selectors with pseudo-classes (:pointerover, :pressed, :disabled) or bindings with converters.ControlTheme for custom control appearance, not WPF-style implicit styles with templates.IServiceCollection. Inject via constructor. ViewModels should never reference View types.pack:// (WPF). Set build action to AvaloniaResource.OpenFileDialog is obsolete. Use TopLevel.StorageProvider for cross-platform file/folder access.DynamicResource for theme-aware colors. Test both variants. Use ThemeVariantScope for per-subtree overrides.CompositeDisposable with ReactiveUI. Implement IDisposable on ViewModels that hold subscriptions.OperatingSystem.Is*().