Contents:

Python Basics: A Free Course for All Skill Levels ➞ Master 4 engaging portfolio projects and connect with an expert. Learn about the course content by clicking here.
Learn MoreMicrosoft has already introduced the third iteration of the cross-platform .NET Core open source, but a tool for developing graphical interfaces is still missing.
Today, there is Xamarin, which is designed exclusively for developing applications for Windows 10 and mobile platforms. However, the question arises: what should developers do who want to create graphical interfaces for Linux or Mac OS operating systems?
In this case, frameworks created by independent developers will come to the rescue.
Choosing the Right Framework for Your Project
I was able to find two relatively well-known frameworks, both of which are built on top of Skia:
I tested both options, and the second one turned out to be more comfortable for me. It includes a markup language, support for the MVVM pattern, quick installation and provides an easy transition from WPF. That is why I decided to give preference to this option.
First Steps in Mastering AvaloniaUI
I plan to develop the application on the Linux Ubuntu platform, although this instruction will be relevant for all .NET Core users. Applications can also be created in Visual Studio with the extension installed, but since this environment is not available on Linux, I will use the terminal for my work.
First, download this repository to your computer:

This archive contains templates that will help you develop an application using AvaloniaUI. If you're not familiar with Git, don't worry: just download the files and unzip them to any convenient location on your computer. After that, open a command prompt and enter the following command:
This will set up the samples for developing the application. To verify that the samples were added, run the following command:
You will be presented with a list of all installed templates. This list should include items such as Avalonia Window, Avalonia .NET Core MVVM App, Avalonia UserControl, and Avalonia .NET Core App. If all of these are present, you're ready to move on.
Using the console, navigate to the directory where you plan to start a new project and enter:
You plan to develop an application using the MVVM pattern. Most of the documentation for AvaloniaUI is presented in this format, which will make the development process more convenient and efficient.
Now you can start developing the application.
Developing a calculator using AvaloniaUI
You will be organized in the following directories.
- The Assets section is intended for loading various program elements, such as icons, images, sound files, and other materials.
- The Models folder is intended for storing classes that will perform the functions of the model.
- ViewModels are classes that serve as a link between the view and the model.
- All windows will be placed in this section.
Let's start by examining the Program.cs file, which is located in the root directory.
We are interested in the AppMain () method. Within this method, the main window (MainWindow) is created, where the data context is set (this is necessary for establishing data binding), after which this window is launched.
This approach allows you to define your own application initialization logic. For example, you can create a model instance and then pass it to the MainWindowViewModel() constructor. However, first you need to define a constructor that can accept this argument.
Our application is simple, so we decided to place all the business logic directly in the MainWindowViewModel.cs file. All the necessary properties and methods will be defined in this file.
First of all, you need to include the ReactiveUI namespace, as it serves as the basis for implementing the MVVM pattern in AvaloniaUI.
After that, you can start writing the code itself.
You need to create the interface code for the main window in the MainWindow.xaml file.
It is worth noting that the presented XAML is very similar to that used in WPF: it contains the same elements and attributes, and also uses grids and data binding mechanisms. However, in this case, you can use regular methods as commands, which is not possible in WPF.
To build and run the application, enter the following command in the terminal:
Please provide the text you want to rework.

Now the application can be easily compiled for various operating systems, and no additional steps are required to port it to a new platform.
Conclusion
A decade or so ago, this would have seemed strange, but today we are able to create programs for Linux using a language that was originally developed for creating applications on Windows.
Read also:
- .NET is a platform developed by Microsoft that is used to create a variety of applications, ranging from desktop applications to web services. The main goal of .NET is to simplify the software development process by providing developers with powerful tools and libraries.
The platform includes several components, including the .NET Framework, .NET Core, and Xamarin. The .NET Framework is designed for creating applications that run on Windows, while .NET Core and Xamarin provide the ability to develop cross-platform solutions that can run on various operating systems, such as macOS and Linux.
In addition, .NET supports many programming languages, including C#, F#, and Visual Basic, allowing developers to choose the right tool for a specific task. Another important part of .NET is the runtime environment, called the CLR (Common Language Runtime), which is responsible for executing code and managing its lifecycle, including garbage collection and exception handling.
Using .NET significantly speeds up the development process thanks to an extensive library of ready-made solutions and components, saving time and resources. The platform also provides high performance and application security, making it popular among developers worldwide.
- Podcasts, front-end development, and networking: ways to join the IT community and get free training.
- Creating a messenger in C#. Part 1. Interface Design

