loading experience

Avalonia UI

Avalonia UI: .NET interfaces for Windows, macOS, Linux and beyond

What Avalonia is, how it works and when to choose it for a cross-platform desktop application.

Avalonia UI: .NET interfaces for Windows, macOS, Linux and beyond

Avalonia UI is an open-source framework for building graphical interfaces with C# and XAML that run on Windows, macOS and Linux, as well as iOS, Android, the browser (WebAssembly) and embedded devices.

The same C# and XAML code, looking identical on every platform.
The same C# and XAML code, looking identical on every platform.

How it works

Unlike frameworks that use each system's native controls, Avalonia draws the whole interface itself with its own rendering engine based on Skia. The result is an application that looks identical on every platform, pixel for pixel.

The first project

dotnet new install Avalonia.Templates
dotnet new avalonia.mvvm -o WarehouseManager
cd WarehouseManager
dotnet run
<Window xmlns="https://github.com/avaloniaui"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:vm="using:WarehouseManager.ViewModels"
        x:Class="WarehouseManager.Views.MainWindow"
        x:DataType="vm:MainWindowViewModel"
        Title="Warehouse manager" Width="900" Height="600">
    <StackPanel Margin="20" Spacing="10">
        <TextBlock Text="{Binding Title}" FontSize="24" />
        <Button Content="Refresh" Command="{Binding RefreshCommand}" />
    </StackPanel>
</Window>

Strengths

  • Linux as a first-class citizen, alongside Windows and macOS.
  • XAML familiar to those coming from WPF, with a styling system inspired by CSS.
  • Performance and Native AOT support for compact applications that start quickly.
  • MIT licence and a very active community.

When to choose it

Business and technical applications that must also run on Linux, industrial tools, interfaces on embedded panels, migrations of old WPF applications to more platforms. For apps designed mainly for phones, with a native look, .NET MAUI remains an alternative worth considering.

Comments (0)

No comments yet.

Leave a comment