Cross-platform architecture
Avalonia renders controls using Skia rather than wrapping native platform controls. This means your AXAML views, view models, and business logic all produce identical results on every platform. This page covers what you can share, what needs platform-specific handling, and how to choose the right approach.
Avalonia's approach to code sharing
Because Avalonia draws its own controls, you get a consistent look and behavior across Windows, macOS, Linux, iOS, Android, and the browser. In a typical Avalonia application, the following are fully shared:
- Views (AXAML files and code-behind)
- View models and business logic (plain C# or F# classes)
- Styles and themes
- Platform services such as file pickers, clipboard, launcher, dark mode detection, and safe area handling
The areas that sometimes require platform-specific code include:
- Hardware sensors (GPS, accelerometer, gyroscope)
- Push notifications
- Bluetooth, camera, and biometrics
- System tray and other OS-level shell integrations
For device APIs that Avalonia does not abstract, Microsoft.Maui.Essentials provides a common layer that works with Avalonia on .NET 8 and higher. Keep in mind that Maui.Essentials does not cover Linux, browser, or non-Catalyst macOS targets.