Back to Blog

Building a Cross-Platform Desktop App with Avalonia UI and C#

#avalonia#csharp#desktop
Building a Cross-Platform Desktop App with Avalonia UI and C#

One of the projects I work on at Hantechno needed a desktop app that had to run on Windows, macOS, and Linux without maintaining three separate codebases. I tried a few options first — Electron made the initial list, then got crossed off early because it needed a heavy browser runtime for an app that didn’t actually need UI that heavy. After some trial and error, I settled on Avalonia UI with C#.

Why Avalonia, and not something else

Avalonia feels a lot like WPF in terms of XAML and data binding, so since I was already comfortable with .NET from earlier work, the learning curve wasn’t too steep — most of the MVVM concepts I already knew carried over directly. The difference is that Avalonia is genuinely cross-platform: one codebase, rendered itself on each OS via Skia, so the UI stays consistent without needing native controls per platform, which usually cause slightly different behavior on each OS anyway.

What I like

Hot reload for previewing the UI helps a lot during fast iteration — change the XAML, see it immediately without a full rebuild. Styling is also CSS-like through resources and style selectors in XAML, so if you’re already comfortable with web, it doesn’t feel too foreign. The community is active, though clearly smaller than Electron’s or Flutter’s — a specific question sometimes takes longer to find an answer for than just googling something React Native related.

What gave me pause

Documentation for advanced cases — custom rendering, native interop with specific OS APIs — is still thinner than more mainstream options. There was one case where I needed low-level access to a network connection for a VPN feature, and I had to dig into Avalonia’s own source code to understand behavior that wasn’t clearly documented. It didn’t make me give up, but it wasn’t the smooth experience of reading Flutter’s far more complete docs either.

For my case, it turned out to fit

The app I work on needs low-level access — VPN connections, remote desktop, security reporting — while still having a UI that’s pleasant for end-users who aren’t all technical. Avalonia plus C# turned out to fit that combination well. No browser runtime like Electron, and performance is much lighter — the difference in startup time compared to Electron apps I’ve used before is noticeable.

If you’re looking for a genuinely cross-platform alternative to WPF, and you’re already comfortable in the .NET ecosystem, it’s worth trying. If you’re starting from zero with no .NET background at all, Flutter or Tauri probably make more sense as a starting point.