Skip to content

Extensions for Avalonia UI desktop applications without XAML

License

Notifications You must be signed in to change notification settings

Mattias1/avalonia-extensions

Repository files navigation

Avalonia Extensions

Some extensions to quickly build Avalonia UI desktop applications without needing XAML. Built on top of Avalonia.Markup.Declarative.

Note that while using these extensions allow you to very quickly setup an application, they do somewhat push you into using Avalonia UI my way, rather than extending Avalonia UI generically.

NuGet packages

You can install the avalonia extensions via the NuGet package Mattias1.AvaloniaExtensions.

Example

This is a simple example application:

using AvaloniaExtensions;

AvaloniaExtensionsApp.Init().StartDesktopApp("Example app", () => new ReadmeComponent());

public class ReadmeComponent : CanvasComponentBase {
  protected override void InitializeControls() {
    AddTextBlock("A simple example application").TopLeftInPanel();
    AddButton("Cancel").BottomRightInPanel();
    AddButton("Ok").LeftOf();
  }
}

For a more elaborate example, you can take a look at the Example App source.

Setup development environment

  • Clone the Avalonia.Markup.Declarative repo in the 'lib' folder
  • Copy the needed files to the 'AvaloniaExtensions/lib/Avalonia.Markup.Declarative' folder with
    mkdir -p AvaloniaExtensions/lib/Avalonia.Markup.Declarative/
    cd lib/Avalonia.Markup.Declarative/src/Avalonia.Markup.Declarative/
    cp -r --parents *.cs ../../../../AvaloniaExtensions/lib/Avalonia.Markup.Declarative/
    cp -r --parents **/*.cs ../../../../AvaloniaExtensions/lib/Avalonia.Markup.Declarative/
    cd ../../../../
    
  • Start the example app with cd ExampleApp/ && dotnet run

Publish release

Create a github release with a tag named 'vx.y.z'.

About

Extensions for Avalonia UI desktop applications without XAML

Resources

License

Stars

Watchers

Forks

Packages

No packages published