Net cross-platform UI framework Avalonia Getting Started - Installation and Use (v11 version)

Introducing Avalonia v11 version

The avalonia v11 version has been released, adding many new features, and the Avalonia extensions have also been upgraded simultaneously.
Main updates:

  1. Accessibility: Added support for various accessibility tools, improving the usability of the Avalonia application.
  2. Input Method Editor (IME) support: allows on-screen keyboard and input in all languages.
  3. Composite renderer: Provides more powerful, efficient and flexible graphics rendering capabilities.
  4. WebAssembly (WASM) support: Allows Avalonia applications to run in the browser, broadening platform support.
  5. iOS and Android support: Developers can build and run Avalonia apps on iOS and Android.
  6. Rich text support: Ability to fully render complex documents with support for adding annotations, hyperlinks, and other inline elements to the text.
  7. Smooth Virtualization: Redesign ItemsControl to improve control efficiency and user experience.
  8. Performance improvements: Improve application speed and efficiency.
  9. Add control themes, nested styles, and theme variations: Make it easier to build consistent and beautiful user interfaces.
  10. Bitmap Effects: Allows applying visual effects to bitmap images.
  11. 3D Transform: Allows the creation of stunning three-dimensional effects.
  12. Ahead compilation and pruning: Increase application speed and reduce application size.
  13. GPU interop: Improved rendering performance and visual effects.
    For details, see:
    https://github.com/AvaloniaUI/Avalonia/releases/tag/11.0.0

Official website:
https://www.avaloniaui.net/

Documentation:
Avalonia Documentation
The documentation has also been updated to version 11. The documentation currently supports Chinese (most of it is already in Chinese), and previous versions of the documentation can also be viewed.
Insert image description here

Install

Add an extension, search for avalonia in the extension, and choose to install "Avalonia for Visual Studio 2022". The latest version is already 11.1. This package depends on "Avalonia Template Studio", and two extensions will eventually be installed.

Insert image description here

After the download is completed, close all vs. Remember to close them all after saving, otherwise they will be forced to close during installation.
Insert image description here

Modify is installed, and the two extensions are installed.
Insert image description here

use

1.Create project

Select the Avalonia category. Version 11 has only one optional project template.
Insert image description here

Modify the project name and location, then click Create
Insert image description here

Then you will enter the Avalonia project creation window to select the platform and functions.

  1. Platform selection, select your target platform, Desktop, Web, Android, IOS, and finally generate the project. Multiple startup projects will be generated based on multiple platforms.

Insert image description here

  1. Choose the design pattern, which is the two MVVM frameworks, choose according to your needs
    Insert image description here

  2. Select other features

Compilation binding, embedded support, etc., not used yet

Insert image description here

Click Create to create (if the subsequent content does not need to be modified, you can create it directly in the first step)

2. Project structure

Multiple projects will be generated after creation

The main project is a class library "AvaloniaApp" which is a class library for common interfaces and codes. Then "AvaloniaApp.Android" and "AvaloniaApp.Desktop" are startup projects for different platforms. This generates different projects according to the selected platform.
Insert image description here

The main development is carried out in the main project, which contains the interface files of the Views folder and the vm class of the ViewModels folder. This can be adjusted according to your own habits.

Insert image description here

Guess you like

Origin blog.csdn.net/qq_39427511/article/details/132747955