XAML-based UI frameworks have developed a lot over the years, and the chart below is the best illustration. These frameworks mainly include: Avalonia UI, Uno Platform and. NET MAUI that support cross-platform applications. In fact, in addition to Avalonia UI, the need for cross-platform XAML is the main driving force for its development. If Microsoft had launched a cross-platform UI framework like Flutter earlier, we might not have had so many options. This has advantages and disadvantages: the advantage is that we have many cross-platform solutions to choose from, and the disadvantage is that different frameworks have different object models and their own unique dialect of XAML syntax.
When focusing on various. NET UI frameworks, we ask the same question: Which XAML UI framework should we use to develop our applications? This is a reasonable and important question. So far there is no clear answer. However, this question is easy to answer for each specific application because the advantages and disadvantages of each framework can be compared and analyzed for specific application requirements. By outlining the advantages and disadvantages of major XAML-based UI frameworks, this document is designed to help companies and developers answer the following questions:
Which XAML framework should I choose to develop my cross-platform applications?
From a strategic perspective, the differences between these XAML-based cross-platform UI frameworks can be described architecturally. These frameworks are all based on the same. NET (formerly Mono) tool. It cannot be ignored that Xamarin's contribution to. NET has enabled these frameworks to exist. In addition, in. NET 6 +, these frameworks use the same runtime and core libraries on each platform.
- Avalonia UI : 完全自己呈现控件和用户界面元素,这一点和 Flutter 相同。
- .NET MAUI : 标准化一组名称、属性、事件,并将它们应用/链接到特定平台的原生控件。如果单个平台不支持某项功能,该功能则不会出现在所有平台的 MAUI 中(不涉及特定平台的代码)
- Uno Platform : 使用选定的几个特定于平台的基本元素来构建和渲染控件。 对于高级控件,这提供了近乎像素完美的结果。这意味着 Uno Platform 像 Avalonia UI 和 Flutter 那样完全渲染控件; 不过, 它还支持直接嵌入特定平台的原生控件,是一个混合架构。
因为 WPF 和 UWP/WinUI 这些基于 XAML 的微软框架不是跨平台的,所以这里不进行详细比较。但是 WPF 可以通过Wine Mono 或者 Avalonia XPF跨平台运行。WinUI/UWP 已通过接下来讨论的 Uno Platform 支持跨平台运行。
-
- Project link **
| Project | Website | GitHub | Docs |
|---|---|---|---|
| Avalonia UI | avaloniaui.net | github.com/AvaloniaUI/Avalonia | docs.avaloniaui.net |
| .NET MAUI | maui | github.com/dotnet/maui | docs.microsoft.com/en-us/dotnet/maui/ |
| Uno Platform | platform.uno | github.com/unoplatform/uno | platform.uno/docs/ |
-
- Other frameworks **
There are other solutions available for. NET cross-platform development that will not be described in detail in this article. Even if this article does not provide detailed comparisons, these frameworks or solutions are worth knowing:
- WPF : 正如上文所讲,WPF 可以通过Wine Mono 或者 Avalonia XPF跨平台运行。对于 WPF 代码量较大的现有应用,可以考虑这种跨平台解决方案。
- Eto.Forms : 一个类似于 .NET MAUI 的 UI 框架,使用平台原生控件构建 UI,XAML 也可以用于序列化和构造 UI。
- Noesis GUI : 用于游戏开发, Noesis GUI 重新创建 WPF,用于游戏引擎(如 Unity)以构建用户界面。Noesis GUI 对 XAML 的支持非常广泛,可以和 Microsoft Blend 一起使用。 如果它可以在游戏引擎之外工作,并且对较小的应用程序有更好的许可,那么它将是一项早于其他跨平台 XAML 实现的有趣技术。
- .NET MAUI + Blazor Hybrid : .NET MAUI 可以托管 Blazor Web 应用(在 BlazorWebView 控件内),使其更像是应用程序和服务容器。对于那些希望将现有 Web 应用程序重新打包并分发为移动应用程序的人来说,这是一个非常有吸引力的选择。
- .NET MAUI + Avalonia UI Hybrid : .NET MAUI 还可以托管 Avalonia UI(在 AvaloniaView 控件里),使其更像是一个应用程序和服务的容器。 由于 Avalonia 只是一个 UI 框架,要轻松获取 .NET MAUI 的所有附加平台抽象功能 (Essentials) 以及更轻松地打包和部署移动应用时,这是一个非常有吸引力的选择。
More often, using. NET MAUI as an application-plus-service container and then hosting other UI frameworks such as Blazor or Avalonia UI is an attractive option. This architecture may gain more attention in the future and is definitely an area worthy of close attention.
Framework comparison
Each framework has a different performance-which is obvious in some places. The following table focuses on areas and characteristics with high influence. Places where all frameworks appear the same will not be shown in the following table (focus only on differences).
This comparison is based on extensive research and experience on various frameworks; the results are inevitably subjective, but it should also be noted that. NET MAUI has the least experience of using it among the three options, which may affect the accuracy of the rankings.
- ○ ˇ Means support this feature Means do not support it️
- ⭐⭐⭐是最高/最好的评分, ⭐是最低/最差的
| Avalonia | .NET MAUI | Uno Platform | |
|---|---|---|---|
| 丨 ** Characteristics ** | |||
| MVVM pattern | ✔️ | ⭐⭐⭐ | ✔️ | ⭐⭐ | ✔️ | ⭐⭐⭐ |
| MVU model | ❌ | ✔️ | ⭐⭐ | ✔️ | ⭐ |
| Pixel-perfect rendering | ✔️ | ⭐⭐⭐ | ❌ | ✔️ | ⭐⭐ |
| control | ✔️ | ⭐⭐⭐ | ❌ | ✔️ | ⭐⭐⭐ |
| styles and themes | ✔️ | ⭐⭐⭐ | ✔️ | ⭐ | ✔️ | ⭐⭐⭐ |
| Support a unified look and feel | ✔️ | ⭐⭐⭐ | ❌ | ✔️ | ⭐⭐⭐ |
| Platform native appearance | ❌ | ✔️ | ⭐⭐⭐ | ✔️ | ⭐ |
| Platform consistency | ✔️ | ⭐⭐⭐ | ✔️ | ⭐ | ✔️ | ⭐⭐ |
| Native control integration | ✔️ | ⭐ | ✔️ | ⭐⭐⭐ | ✔️ | ⭐⭐⭐ |
| XAML syntax and code sharing | ✔️ | ⭐⭐ | ✔️ | ⭐ | ✔️ | ⭐⭐⭐ |
| C#code-hidden sharing | ✔️ | ⭐⭐ | ✔️ | ⭐ | ✔️ | ⭐⭐⭐ |
| hot reload | ❌ | ✔️ | ⭐⭐⭐ | ✔️ | ⭐⭐⭐ |
| third-party support | ✔️ | ⭐ | ✔️ | ⭐⭐⭐ | ✔️ | ⭐⭐ |
| Advanced text format | ✔️ | ⭐⭐⭐ | ❌ | ❌ |
| Non-user interface features | ❌ | ✔️ | ⭐⭐ | ✔️ | ⭐⭐⭐ |
| ▶ Strategy & Development | |||
| Performance (theoretical) | ⭐⭐⭐ | ⭐⭐⭐ | ⭐⭐ |
| Mobile application stability | ⭐ | ⭐⭐ | ⭐⭐ |
| Desktop application stability | ⭐⭐⭐ | ⭐⭐ | ⭐ |
| available controls | ⭐ | ⭐⭐ | ⭐⭐⭐ |
| code license | ⭐⭐⭐ | ⭐⭐⭐ | ⭐⭐ |
| free support | ⭐ | ⭐⭐ | ⭐⭐⭐ |
| paid support | ⭐⭐⭐ | ⭐⭐ | ⭐⭐⭐ |
| project tempo | ⭐⭐ | ⭐⭐ | ⭐⭐ |
| Easy to contribute | ⭐⭐⭐ | ⭐⭐ | ⭐⭐ |
| Code base readability | ⭐⭐⭐ | ⭐ | ⭐ |
| developer experience | ⭐⭐⭐ | ⭐⭐ | ⭐ |
| enterprise support | ⭐⭐ | ⭐⭐ | ⭐⭐⭐ |
| ④ ** IDE and integrated tools ** | |||
| Visual Studio | ✔️ | ⭐⭐ | ✔️ | ⭐⭐⭐ | ✔️ | ⭐⭐ |
| Visual Studio Code | ✔️ | TBD | ✔️ | ⭐⭐ | ✔️ | ⭐⭐⭐ |
| Rider | ✔️ | ⭐⭐⭐ | ✔️ | ⭐ | ✔️ | ⭐⭐ |
| Design tool integration | ❌ | ❌ | ✔️ | ⭐⭐ |
| ▲ ** Platform support ** | |||
| iOS | ✔️ | ⭐ | ✔️ | ⭐⭐⭐ | ✔️ | ⭐⭐ |
| Android | ✔️ | ⭐ | ✔️ | ⭐⭐⭐ | ✔️ | ⭐ |
| Windows Desktop Applications | ✔️ | ⭐⭐ | ✔️ | ⭐ | ✔️ | ⭐⭐⭐ |
| macOS desktop applications | ✔️ | ⭐⭐⭐ | ✔️ | ⭐ | ✔️ | ⭐ |
| Linux desktop applications | ✔️ | ⭐⭐⭐ | ❌ | ✔️ | ⭐ |
| Web Browser (WASM) | ✔️ | ⭐ | ❌ | ✔️ | ⭐⭐⭐ |
| ▲ ** Overall platform support ** | |||
| mobile side | ✔️ | ⭐ | ✔️ | ⭐⭐⭐ | ✔️ | ⭐⭐ |
| desktop program | ✔️ | ⭐⭐⭐ | ✔️ | ⭐ | ✔️ | ⭐ |
| Web | ✔️ | ⭐ | ❌ | ✔️ | ⭐⭐⭐ |
This form was last updated in July 2023.
remarks
MVU model
.NET MAUI 对传统上认为的带有 C# Markup and Comet的 MVU 模式具有最完整的支持. 这是一个活跃的试验性和开发领域,预计未来将得到和 MVVM 的相同级别的支持。Uno Platform 开发了自己的 MVU 变体,称为 MVU-X。这与其他产品有很大不同,并且具有更高的学习曲线,但确实与 XAML 数据绑定集成得更好。MVU 模式这一全新方法的长期可行性还有待观察,在这实验性的方案稳定之前,最好谨慎选择。Avalonia 没有直接的支持 MVU 模式。但是,它提供了两个类库支持使用声明性语法替代 XAML 编写 UI 界面。Avalonia.Markup.Declarative通过在 Avalonia 上提供帮助方法和扩展来支持许多 C#标记概念。这提供了一种用 C#编写 UI 界面的好方法,该方法可以遵循 MVU 模式而不需要使用 XAML。F# 开发人员的另一个选择是Avalonia.FuncUI,它专门为 F#语言提供了类似的支持。值得注意的是,在所有框架中,Avalonia 对 F# 的支持最好(由社区提供)。
Pixel-Perfect Rendering
Of these three frameworks, only Avalonia supports true "pixel-perfect" rendering. This is due to architectural reasons, and only Avalonia has fully drawn its own user interface and controls. Although Uno Platform attempts to implement "pixel-perfect", there are often differences between different platforms due to the use of native basic controls. Uno Platform (except skia) never fully draws its own controls, so it just approaches "pixel-perfect".
Unfixed Lookless Controls, Styles & Themes
当开发人员想到 XAML 时,他们通常会想到无固定外观控件(lookless controls)。能够完全更改控件的样式和默认模板以将其转换为完全不同的内容是 WPF 的一个主要功能。Avalonia 和 Uno Platform 都完整支持自己版本的无固定外观控件(lookless controls)和模板重定义。但是,MAUI 不具备此功能,仅支持更改一些常见的属性。在这方面,可以把 MAUI 看作是 Windows Forms 这类较旧的界面工具包。例如,这意味着在 MAUI 中不支持在按钮内放置图标或图形,而在其他的 XAML 框架中则很容易实现。什么是Lookless Controls WPF 控件的行为是固定的。例如,按钮有一组固定的事件,包括单击事件。不管你用按钮控件做什么操作,它仍然会有一个点击事件。 WPF 控件没有固定的“外观”。Lookless 这个词恰好可以简洁的表达这个意思。 按钮的默认外观是由默认的 XAML 模板定义的,可以替换一个完全不同的模板,从而完全改变按钮控件的外观。
Platform consistency
When developing using cross-platform frameworks, consistency between application and code is important. You don't want to develop and verify a feature on one platform and then find out that it works differently on another platform. In this regard,. NET MAUI is very poor because it links to native controls on each platform. Not only does this require verification everywhere, but it also requires writing custom controls multiple times, while spending a lot of time adjusting the content to make it look consistent (similar to getting a web page to render correctly on all browsers) In most cases, Uno Platform performs better than MAUI. However, it also has some serious problems, and some features are not supported on all platforms. Features that are available on all platforms usually behave consistently, but there can also be subtle differences that are difficult to fix. Due to architectural differences, Avalonia UI easily outperforms other frameworks in terms of platform consistency. Avalonia renders completely on its own, so it always looks exactly the same on every platform (except for fonts, input differences, pop-ups, etc.).
Native control integration
Both. NET MAUI and Uno Platform are built on top of and fully integrated with Xamarin Native. This means that both frameworks can access platform-specific native controls through c#binding. This is very powerful for accessing native platform functions and controls, with almost no compromise. Native controls can be added directly to XAML and code-behind, just like any other control built into the framework itself. In contrast, Avalonia UI is its own UI layer that does not integrate directly with Xamarin Native (and its platform-specific controls). Instead, Avalonia provides a NativeControlHost that allows local controls to be embedded in Avalonia applications. However, this is not as concise as it is in MAUI or Uno Platform. Similar to WindowsFormsHost in WPF, but unlike it, the Avalonia UI also uses 3D elements to solve the "airspace problem" and can draw the UI directly on various surfaces. This actually allows Avalonia to run on a game engine or DirectX, which is not possible in other frameworks.
XAML syntax and code sharing
Uno Platform has the highest rating in terms of code sharing. It uses the same XAML dialect and object model as UWP/WinUI, which makes it 100% compatible between XAML and C#. Both Avalonia and MAUI deviate from past versions of XAML and are incompatible with either WPF or UWP/WinUI. Still, Avalonia strives to be similar to WPF in terms of object models, and MAUI deviates for few reasons (Height/Width, TextBlock, etc.). In some cases, Avalonia has also successfully become a more powerful next-generation WPF syntax and object model. Due to some changes to XAML (styles, IsVisible of bool type, simplified grid row/column syntax, etc.), some operations are made easier in Avalonia. Compared to MAUI, Avalonia has better compatibility and code sharing with existing WPF code, resulting in a higher overall score.
Advanced text format
The original XAML framework, WPF, has a very advanced text format API (FlowDocument). This is still more advanced than what is found today in WinUI 3 or previous UWP. In fact, prior to Avalonia UI version 11.0, no other cross-platform XAML framework supported advanced text features. Now, Avalonia UI has almost the same API as WPF and can perform text formatting and measurement that is simply impossible on the. NET MAUI and Uno Platform. Due to architectural differences, Avalonia UI is likely to remain the only framework that supports advanced text (that does not rely on third-party controls) for the foreseeable future. This includes controls such as RichTextBox that can be implemented in Avalonia but are very difficult in the Uno Platform and almost impossible in. NET MAUI.
Non-UI functions
The main drawback of Avalonia UI is that it is just a UI framework. NET MAUI has necessary software packages, and Uno Platform is a complete application development platform after UWP. It can be said that. NET MAUI and Uno Platform are more than just a UI framework. This means that things such as persistence, file processing, authentication, localization, and device permissions are available immediately in. NET MAUI and the Uno Platform, but not in Avalonia. Uno Platform even has some advanced audio-related APIs that are only found in UWP and can be cross-platform. Uno Platform attempts to cover the entire UWP exposed API (API-surface), which includes a large number of APIs. The entire API is automatically generated, and many of its functions do not implement stubs. This means that most non-UI APIs are not available, and exceptions will be raised if they are used in an application. This does cause some problems during development, but the compiler will show which unimplemented APIs are being used. Despite this, Uno Platform still has more non-UI features than other frameworks.
performance
XAML originated from desktop applications and itself consumes quite resources. WPF (the original XAML framework) typically builds entire views from XAML markup at runtime, which can severely impact performance when first loaded. In addition, MVVM is used to bind controls to viewmodels through reflection binding, which is inherently slower than compiled code. Most importantly, traditional XAML controls have higher performance and system requirements, which may be an issue that needs to be considered for mobile or cloud platforms. UWP and Uno Platform improve this by allowing lazy loading by x: Load. They both support compilation binding using x: Bind. The architecture of MAUI completely avoids the first problem by using native controls. The Avalonia UI has largely switched to pre-compiled XAML and compilation bindings, which also solves both issues. All three frameworks theoretically perform better than WPF. Performance-related MVU models should not be ignored. The UI is not constructed from XAML tags; it is usually constructed in code along with business logic in code-behind. By default, this means that controls and user interface elements are constructed only when referenced by code and need to be displayed. In this way, the performance of using MVU mode is expected to exceed the performance of MVVM mode applications. Both MAUI and Uno Platform support MVU mode. Avalonia also fully supports creating UIs in code instead of using XAML, achieving the same performance benefits. MAUI's performance was not intentionally rated as two stars, but was lower than Avalonia's three stars. The reason is that MAUI uses native controls and is interoperable. Native compilation largely alleviates this problem, but C#and Android control integration both degrade performance. However, Avalonia fully renders itself and does not interact with android native controls (unless it hosts native views). This means that Avalonia can basically have the performance of a video game. The performance of the Uno Platform is usually adequate on most platforms. However, on Android, there are serious interoperability performance issues between the. NET runtime and the Java runtime. This is a problem with. NET and Android itself. However, due to the architecture of the Uno Platform (integrated with native controls), this interoperability is always necessary. This means that on Android, Uno Platform's performance is fundamentally inferior to other frameworks, and high-performance Uno Platform applications on Android are currently impossible to achieve.
apply a stability
MAUI ranks the same as Uno Platform for mobile application stability; however, it is common to encounter layout issues on different platforms that require a lot of context-specific code and markup. There are still many unresolved situations and bugs in the Uno Platform that will appear throughout the development process. This is largely the result of a strategy where rapid development speeds outpace correctness and stability. In contrast, the Avalonia UI has stability in mind from the beginning: its functionality is complete. In practice, the Avalonia UI is probably the most stable and easiest to develop.
License Agreement for Code
Uno Platform 采用的不是 MIT license,而是 Apache 2.0。Apache license 不像 MIT 那样宽松。除了别的方面,这阻止了代码共享回其他 MIT 许可的框架。Uno Platform 可以使用 MIT 许可项目(如 WinUI、WPF 和 Avalonia)的源代码,但这些项目基本上不能使用 Uno Platform 的代码。这就是为什么 Uno Platform 在这里排名较低。Avalonia UI 最初完全是 MIT 授权的,并获得了三星评级。但是,随着 re-licensing of the composition renderer,禁止以原始二进制形式以外的任何形式进行修改和分发,这降低了分数。合成渲染器(composition renderer)是 Avalonia 版本 11+中唯一支持的渲染器,其他渲染器已被删除。这使得修改 Avalonia 并在您自己的应用程序中分发它被禁止。该团队已经澄清,该许可证将“在 v11 进入 GA 时恢复到 MIT”。(此部分于 2023 年 7 月废弃,有下一段内容替代。) Avalonia UI 完全是 MIT 授权的,可以在大多数.NET 基金会和 WinUI 项目之间免费共享代码。对于需要完全掌控 UI 框架以达到快速推送修复,确保特定应用稳定性的目的,甚至是想替换自定义的内部组件的公司来说,Avalonia UI 是一个理想的选择。
support
Although MAUI was developed by Microsoft, Avalonia and Uno Platform still rank higher than MAUI in terms of paid support. This is mainly due to the agility of small companies. Microsoft is now highly bureaucratic, and any feedback or changes, even small, require extensive discussion before action can be taken. This is in sharp contrast to Avalonia, which can adopt new features very quickly, and the Uno Platform communicates very quickly. In terms of free support, the Uno Platform community received responses on par with the larger MAUI community. But Uno Platform can usually resolve bugs and implement functionality faster.
Readability and ease of contribution of the code base
Avalonia UI has the cleanest code base, greatly lowering the threshold for public contribution. Uno Platform and. NET MAUI are much more complex, as you can see from the code. In the long run, increased complexity often becomes costly in terms of maintenance and stability. In the Uno Platform, this complexity is necessary to meet architectural goals and support native control integration.
development experience
Avalonia UI has the best overall development experience. The code base is easy to read, and the development debugging experience using Rider is first-class (worse on other IDEs). NET MAUI follows closely because it now integrates more with Visual Studio than with all other frameworks. Due to the need to verify/adjust each feature/view separately on each platform,. NET MAUI lacks the overall development experience. The Uno Platform has a poor development experience, less integration with Visual Studio, long compilation times, and difficult debugging. For more details about the development experience, see the IDE Integration section.
enterprise support
At first glance, the. NET MAUI developed by Microsoft seems to have the strongest enterprise support. However, Microsoft has not invested a lot of resources in this project, and based on Microsoft's history of abandoning UI frameworks, there is also uncertainty about its support for MAUI. Although Avalonia was originally fully open source, it now has the support of companies from some core team members. This provides a good measure of stability and revenue for maintaining the project. However, what needs to be cautious is the increasing influence of enterprises on it and the progress of closing down the source of the code base. For example, the composite rendering engine is not now a free license that can be modified (while the rest of the code is MIT licensed), which will change back after the official release of V11. Uno Platform remains unique in corporate sponsorship with innovation and incredible number of communications and responses. It is worth noting that they have cooperation and close communication with Microsoft.
Visual Studio integrated
No framework has Samsung in terms of Visual Studio integration. This is because Visual Studio has historically focused on windows platform frameworks such as WinForms, WPF, UWP, and WinUI, and has hardcoded these frameworks in a non-extensible manner. However, support for. NET MAUI has been greatly improved (starting from being almost unusable at release). Uno Platform's Visual Studio integration still needs to be improved, and it is obviously the one with the poor development experience among the three. It's not their fault, because Microsoft does not reasonably support any other project type that uses.xaml files. Avalonia support in Visual Studio provides reliable previewer support, and most features work-through the use of the special.axaml extension-but XAML is not as smooth as other IDEs such as Rider.
Visual Studio Code integration
Uno Platform 团队为Visual Studio Code 开发了一个扩展,支持开发,更重要的是,可以调试移动和 Web 应用程序。这是 VS Code 工具向前迈出的一大步,而 VS Code 工具作为 C#/.NET 应用程序的 IDE 历来对开发人员不友好。令人惊讶的是,该扩展还支持.NET MAUI 应用程序。Uno Platform 团队确实在这方面迈出了一步,填补了 VS Code 支持 C#/.NET 应用程序方面长期存在的空白,因此 Uno Platform 在这款 IDE 集成方面获得了三颗星的评价。Uno Platform 应用程序现在在 Visual Studio Code 中得到了最好的支持(除非在 Windows 上开发 WinUI,其中 Visual Studio 仍然是最好的)。请注意,这个扩展不是开源的。Avalonia UI 于 2023 年 7 月公布 了一个支持 XAML 预览和代码补全的Visual Studio Code 插件预览版。这使得 Avalonia UI 在 Visual Studio Code 中更易于开发,并将使其成为一个可选的 IDE。
Design tool integration
Currently, only the Uno Platform supports the design tool (Figma) to build UIs. This support is provided by a closed-source XAML generator. In the past, Microsoft Blend was available to WPF to support the same effect. The quality and efficiency of the generated XAML may be insufficient, but for companies with a clear division between the design and development teams, it facilitates the transition from designer to developer. NET MAUI does not support any design tools and may never be due to its architecture. However, it provides out-of-the-box support for real-time editing of XAML, which allows designers to tweak and add some UI elements directly in the application before adding code. Uno Platform also supports real-time editing of XAML.
platform support
Uno Platform supports most platforms, runs on almost any device, and has achieved varying degrees of success (its strongest areas are mobile and web). Uno Platform directly supports Windows desktop applications through WinUI/UWP, so it has the highest ranking among Windows desktop native applications. It should be noted that in Uno Platform, some backends and platforms lack the functions of other backends and platforms. This may result in you being able to do things on iOS/Android that you can't do on Linux. Therefore, platform support is inconsistent and should be carefully reviewed. This is especially true on macOS, where the Uno Platform performed extremely poorly in the last test (2021). Nowadays, it is often better to build macOS apps using macCatalyst because the Uno Platform has significantly better and more complete support for iOS. Skia backend is also available on all desktop platforms (even older versions of Windows). Keep in mind (as described in the Performance section) that Uno Platform does not perform as well on Android as on iOS. Avalonia UI is far ahead of other frameworks on macOS and Linux desktop platforms. Avalonia also scores high on the Windows desktop platform, but does not use native UI toolkits, so it scores a little lower than Uno Platform. Mobile and Web support is newly released in version 11.0 and may take some time to stabilize, so the score is currently low. Avalonia's Web implementation is presented as an HTML5 canvas. This will never be as good as the Uno Platforms architecture, where it is fully integrated into HTML elements. NET MAUI does not support Linux or the Web at all. It is obviously not as good as the other two frameworks in terms of platform coverage.
Recommended frameworks by platform
On every platform, there is the best performing framework. This is also subjective; however, overall, the assessment should be correct and take into account all factors.
| platform | best framework | |
|---|---|---|
| Windows | WPF/WinUI | |
| macOS | Avalonia UI | |
| Linux | ||
| Android | ||
| iOS | ||
| Web/Wasm |
If an application only needs to be used on a desktop platform, Avalonia is a very good choice. Its support for Windows is first-class, but because it is not a native UI, it ranks behind WinUI or WPF. However, Avalonia has no obvious shortcomings in desktop applications, and many desktop applications already use it. In fact, Avalonia even supports operations that cannot be done in WPF, such as overlaying XAML controls on the DirectX surface.
If the application needs to be cross-platform, you can write it in WinUI or WPF first. Using the WPF codebase on Windows converts well to Avalonia, but three different XAML variants are still required. For this reason, it is generally best to use WinUI because it can be shared 100% with the Uno Platform's code. Only two XAML variants are needed.
Please also note:
- Web/Wasm is a clear advantage of the Uno Platform. Due to architectural differences (fully using Skia rendering), it is difficult for Avalonia to compete in this area.
- Avalonia UI is more like Flutter's competitor. It uses Skia (or choose Direct2D on Windows) to fully render itself on each platform. This has a big performance advantage over UnoPlatform, especially on macOS and Android. In this way, Avalonia has the purest architecture of all frameworks and the lowest threshold for community participation.
- The Avalonia UI is positioned as the next generation of WPF, and it re-implements most of its functionality. Avalonia draws ideas and code from WPF(Grid, text formatting) and WinUI (ItemsRepeater, touch input APIs), while still has some unique ideas not found in other XAML frameworks (in some ways closer to CSS's advanced style system). It is now ready for desktop application developers, especially those who already have WPF code. This transition is not too smooth for UWP/WinUI developers, but the latest features of UWP/WinUI have been added in version 11 to improve the transition. For enterprise applications that do not want to change existing WPF code, Avalonia also offers Avalonia XPF, which implements an open source WPF code library on top of the Avalonia rendering engine.
- NET MAUI is not specifically listed as the best solution for any platform. It is most useful for small applications without complex UIs. Even in moderately complex applications, its practicality and ability to share code between different platforms will soon lag behind other frameworks. However, in certain lines of business or simpler applications, MAUI may be a better choice. MAUI has also recently been able to host both Blazor and Avalonia UIs, which provides an interesting option for certain scenarios.
- The most suitable choice for versions before Windows 10 is Avalonia. Although Uno Platform also has solutions based on Skia, it lags far behind in terms of functionality, stability and integrity.
- As the table above shows, using two dialects of XAML supports all platforms well. WinUI/UWP is available for Windows (Uno Platform for mobile), and the rest uses Avalonia.
References and links
- Question: XAML Flavor, Architecture & Roadmap
- The New .NET Multi-platform App UI
- Goodbye Xamarin.Forms
- Putting “Universal” back into UWP
- Evolution of Client Development: Richard Campbell
- [Spec] Slim Renderer Architecture
- Discussion: Compatibility with WPF, UWP and WinUI
- Project Reunion: An End to Microsoft’s UI Madness?
conclusion
It took us years to get here, but we finally have some powerful. NET UI frameworks that cover all uses. Interestingly, these frameworks have developed some unique and almost complementary features. Everything you might want to try is included in one of these methods. Today, we can write cross-platform XAML/C#applications that work well. Most of this technology (except for the UI layer) is based on Mono, so most of the credit goes to Xamarin.
The achievements of each framework are remarkable. However, no one dominates all platforms, and each framework has its own advantages and disadvantages. Uno Platform originated from Android/iOS and is the strongest on mobile platforms and the web. Avalonia originated from desktop applications and works best on Windows/Linux/macOS, but support for mobile devices is rapidly evolving. As of 2023, Uno Platform's macOS support is experimental at best and can only be used to develop simple applications. As of 2023, Avalonia initially supports only mobile devices, but is actually more stable on all platforms. However, two different UI frameworks may still be needed to implement cross-platform UI based on XAML-based.
Original link: github.com/robloo/PublicDocs/blob/master/XAMLFrameworkComparison.md
Author: czwy
Source: www.cnblogs.com/czwy/p/17572226.html
版权:本作品采用「署名-相同方式共享 4.0 国际」许可协议进行许可。