BT

Avalonia Beta 1 Brings Many Improvements over WPF

| by Jonathan Allen Follow 594 Followers on Feb 27, 2018. Estimated reading time: 1 minute |

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 Stage
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.

Tell us what you think

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

Email me replies to any of my messages in this thread
Community comments

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

Email me replies to any of my messages in this thread

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

Email me replies to any of my messages in this thread

Discuss

Login to InfoQ to interact with what matters most to you.


Recover your password...

Follow

Follow your favorite topics and editors

Quick overview of most important highlights in the industry and on the site.

Like

More signal, less noise

Build your own feed by choosing topics you want to read about and editors you want to hear from.

Notifications

Stay up-to-date

Set up your notifications and don't miss out on content that matters to you

BT