Xamarin Forms platform implemented with Avalonia (A multi-platform .NET UI framework)
Xamarin.Forms provides a way to quickly build native apps for iOS, Android, Windows and macOS, completely in C#.
Read more about the platform at https://www.xamarin.com/forms.
Avalonia is a WPF-inspired cross-platform XAML-based UI framework providing a flexible styling system and supporting a wide range of OSs: Windows (.NET Framework, .NET Core), Linux (GTK), MacOS, Android and iOS.
Read more about the framework at https://avaloniaui.net.
Getting Started (中文说明)
-
Creating a new Avalonia project, read more about it at http://avaloniaui.net/docs/quickstart/create-new-project.
-
You can find the packages here NuGet and install the package like this:
Install-Package Xamarin.Forms.Platform.Avalonia
- Build a Xamarin.Forms App, read more about it at https://docs.microsoft.com/en-us/xamarin/get-started/first-app.
- Add the new created Xamarin.Forms App project as project reference to your new created Avalonia project.
- Edit MainWindow.xaml.cs, add using:
using Xamarin.Forms.Platform.Avalonia;
- Change the base class of MainWindow to FormsApplicationPage, and add Forms.Init() and LoadApplication() method call, 'FormsGallery.App' in the code should be the name of your Xamarin.Forms App:
public class MainWindow : FormsApplicationPage
{
public MainWindow()
{
InitializeComponent();
#if DEBUG
this.AttachDevTools();
#endif
Xamarin.Forms.Forms.Init();
LoadApplication(new FormsGallery.App());
}
private void InitializeComponent()
{
AvaloniaXamlLoader.Load(this);
}
}