The team behind Avalonia UI, an open source project for cross-platform GUI applications based on Windows Presentation Foundation (WPF), have introduced Avalonia XPF, a closed-source project currently in private preview, aimed at enterprises that need to port WPF applications to other platforms.
Microsoft has its own cross-platform desktop framework called MAUI (Multi-Platform App UI), but although this is built on .NET, it is not compatible with WPF and uses a different flavour of XAML, an XML language used for defining a user interface. MAUI was also delayed and even after its launch has a reputation for not being ready for production.
Avalonia UI is an open source framework created by Steven Kirk. It was conceived as cross-platform WPF but as Kirk told me two years ago he found himself “changing things using more modern language and more modern features,” the result being that strict compatibility was lost.
Avalonia is now a highly active project, appealing to developers frustrated with Microsoft’s many and various approaches to cross-platform coding. The team came to believe though that there was room (and commercial opportunity) for a new framework using Avalonia code but with a focus on WPF compatibility. That is Avalonia XPF. “We enable WPF apps to run on macOS and Linux with our fork of WPF, which allows us to maintain API compatibility,” the site claims.
Mike James, a Microsoft cloud advocate and former Xamarin employee who also works on Avalonia XPF, told us that “demand for Avalonia has exploded in the last 18 months. We need to grow the team and we were looking at ways in which we can increase our revenue without taking away from our community.
“One of the biggest pain points for enterprises is that they have to rewrite their applications, so we created XPF which sits on top. It has a dependency on Avalonia UI and it’s a fork of Microsoft’s open source WPF. We’ve taken that and removed all the low-level implementation which ties into Windows, and replaced it with Avalonia UI. This enables businesses to take their existing WPF apps and run them on MacOS and Linux without having to change a single line of code.”
The ”single line of code” thing seems optimistic, particularly as James also referenced teams working on porting customer projects, but the fact that it is a port of WPF makes it a more promising proposition than porting to MAUI or some other framework, such as Google’s Flutter.
The main categories of application are not only desktop, but also embedded solutions, hence the interest in running on Linux. “One of the companies that is interested is a medical device manufacturer,” James told us. Windows, Linux and macOS are currently supported, with mobile platforms a future possibility.
Will there also be a benefit to the open source Avalonia UI project? “Totally, there’s already a huge amount of benefit,” James told us. “There’s lots of changes that end up going back to Avalonia.”
James said that MAUI, although based on the earlier Xamarin Forms framework, “has a way to go, to reach the same number of features that Xamarin Forms developers previously had.”
The two frameworks also take a different approach. Both Xamarin Forms and MAUI use native widgets, whereas Avalonia UI and XPF use the Skia 2D graphics library to draw controls (as does Flutter).
What does Microsoft think about Avalonia XPF? “Microsoft already supports [Avalonia] and gave us a donation last year, quite a handsome sum,” said James. “We’re the most active community project that’s part of the .NET Foundation and Microsoft fully understands the value of Avalonia, that we’re not competitive.”
If the existence of Avalonia XPF means that organisations stay on the .NET platform rather than migrating to Flutter or elsewhere, that is a better outcome for Microsoft.
Avalonia XPF is currently closed-source and the licensing, James tells us (without quoting figures), is likely to be too expensive for independent developers. “We want eventually to make it available to everyone. It’s significantly cheaper than a total rewrite for a complex application, but probably outside the realm of acceptability for an indie developer.”
Regarding open source, James said that “we’re in two minds. We want to make sure that people still build with Avalonia. We don’t want to cannibalize our own community and have people build fresh apps with WPF. But we may make it available to open source down the line.”