# Avalonia — Cross-Platform .NET UI Framework for Desktop, Mobile & Web > A cross-platform UI framework for .NET that lets you build apps for Windows, macOS, Linux, iOS, Android, and WebAssembly from a single C# and XAML codebase. ## Install Save in your project root: # Avalonia — Cross-Platform .NET UI Framework for Desktop, Mobile & Web ## Quick Use ```bash # Install the Avalonia templates dotnet new install Avalonia.Templates # Create a new MVVM app dotnet new avalonia.mvvm -n MyApp cd MyApp dotnet run ``` ## Introduction Avalonia is an open-source UI framework that brings WPF-style XAML development to every major platform. It provides a retained-mode rendering pipeline with its own layout and styling engine, so apps look and behave consistently whether they run on Windows, macOS, Linux, iOS, Android, or in the browser via WebAssembly. ## What Avalonia Does - Renders pixel-identical UI across Windows, macOS, Linux, iOS, Android, and WASM - Uses a XAML dialect with data binding, styles, control templates, and resource dictionaries - Provides an MVVM-first architecture with built-in ReactiveUI and CommunityToolkit support - Ships a DevTools inspector for live visual tree and property debugging - Offers a Skia-based or Composition-based rendering backend for GPU-accelerated drawing ## Architecture Overview Avalonia's rendering pipeline sits on top of platform-specific backends (Win32, X11, Cocoa, Android, iOS, browser canvas). The layout engine processes a visual tree of controls, each with measure and arrange passes similar to WPF. Styles are resolved via a CSS-like selector system that cascades through the tree. The Composition renderer batches draw calls and sends them to Skia or Direct2D for GPU execution. Input is abstracted through platform dispatchers that feed pointer, keyboard, and touch events into the routed event system. ## Self-Hosting & Configuration - Install .NET 8+ SDK and the `Avalonia.Templates` NuGet package to scaffold projects - Choose a project template: `avalonia.mvvm`, `avalonia.app`, or `avalonia.xplat` for mobile targets - Configure `App.axaml` for global styles, themes (Fluent or Simple), and resource dictionaries - Add platform heads (iOS, Android, Browser) by including the corresponding target framework in the csproj - Use `dotnet publish` with runtime identifiers (`win-x64`, `osx-arm64`, `linux-x64`) for platform builds ## Key Features - True cross-platform: desktop, mobile, embedded, and WebAssembly from one codebase - Familiar XAML and C# development model for WPF and UWP developers - Hot Reload for XAML changes during debugging - Fluent and Simple built-in themes with full CSS-like style override support - Extensive control library including DataGrid, TreeView, and third-party ecosystem ## Comparison with Similar Tools - **.NET MAUI** — Microsoft's official cross-platform framework using native controls; Avalonia uses its own rendering for pixel-perfect consistency - **Uno Platform** — renders via native controls or Skia; Avalonia is Skia-first with a WPF-closer API - **Electron** — web-tech desktop apps with higher memory footprint; Avalonia is native .NET - **Flutter** — Dart-based with its own engine; Avalonia targets .NET developers with XAML - **wxWidgets** — C++ native-widget toolkit; Avalonia is managed code with MVVM patterns ## FAQ **Q: Can I use Avalonia if I know WPF?** A: Yes. The XAML dialect, data binding, and control model are intentionally close to WPF, though some APIs differ. **Q: Does Avalonia support AOT compilation?** A: Yes. Avalonia works with .NET Native AOT for reduced startup time and smaller binaries on supported platforms. **Q: How mature is mobile support?** A: iOS and Android support reached stable status in Avalonia 11. Production apps ship on both platforms. **Q: Is there a visual designer?** A: The Avalonia extension for JetBrains Rider includes a live XAML previewer. VS Code and Visual Studio extensions also provide previews. ## Sources - https://github.com/AvaloniaUI/Avalonia - https://docs.avaloniaui.net/ --- Source: https://tokrepo.com/en/workflows/asset-777c4ff9 Author: AI Open Source