BT

InfoQ Homepage News Avalonia Beta 1 Brings Many Improvements over WPF

Avalonia Beta 1 Brings Many Improvements over WPF

Bookmarks

Avalonia describes itself as a "cross platform .NET UI framework inspired by Windows Presentation Framework (WPF), with XAML, data binding, lookless controls and much more." Having just reached its first public beta, it is already showing some interesting improvements over the venerable WPF version of XAML.

One of the major annoyances of traditional XAML development is the need to create ICommand objects. Unless you need the CanExecute functionality, an ICommand is essentially just a wrapper around a normal method. The construction of these objects often results in a lot of otherwise unnecessary boilerplate code in view-models. Even worse, data models have to either expose this UI-centric concept or be hidden behind a view-model style proxy.

Avalonia offers a rather obvious and easy fix -- commands on user controls can be directly data-bound to methods. ICommands are still supported when needed, but most of the time they can be ignored.

Another time saver offered by Avalonia is syntax support for relative sources. Rather than the lengthy "{Binding Text, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Border} AncestorLevel=1}}" you can write "{Binding $parent.Text}".

New Previewer Architecture

Since Avalonia is meant to be cross-platform, it needs developer tools that are likewise cross-platform. Once such tool is the new previewer architecture. Like the Language Server Protocol used by .NET, the previewer will run as a separate process. By default, it will present the IDE with a rendered bitmap transferred via TCP: "The AvaloniaVS extension has already been updated to use this new protocol, and hopefully now designers for other IDEs will be coming soon!"

Getting Started

If you are using Visual Studio on Windows, the Avalonia for Visual Studio extension provides the necessary tools and project templates. For other platforms, you can use the Avalonia templates for .NET Core.

Avalonia is released under the MIT license and Avalonia is looking for developers who can contribute time to the project.

Rate this Article

Adoption
Style

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Community comments

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

BT

Is your profile up-to-date? Please take a moment to review and update.

Note: If updating/changing your email, a validation request will be sent

Company name:
Company role:
Company size:
Country/Zone:
State/Province/Region:
You will be sent an email to validate the new email address. This pop-up will close itself in a few moments.