📜 ⬆️ ⬇️

Third alpha version of Perspex UI Framework with iOS / Android support

We are pleased to present the third alpha version of Perspex (see previous announcement ).
Perspex is an open source, cross-platform UI framework for .NET, made in the image of WPF, with XAML, bindings, control templates, own rendering system and other buns.

This release adds initial support for iOS and Android platforms, improves designer and XAML, fixes many bugs.


')
List of changes under the cut.


iOS / Android

Using our new backend in C ++ based on Skia, it became possible to use a single drawing code for all platforms (except WinRT, but the current Direct2D backend should start there), which made it possible to quickly port to mobile platforms. Currently, support is only at the basic level (see video), there is no multi-windowing, pop-ups, text input does not work on iOS, and gestures are converted into mouse events, but we are working on it. Using the native backend will allow you to build for Android without using Xamarin by using libmono and NativeActivity. Since iOS is a bit more complicated, the LGPL-license does not allow using Mono-runtime, so you have to wait for the launch on iOS coreclr.

XAML

In the previous version, the XAML binders were a bit buggy, in this version a lot of work has been done on them, which allows them to be used very confidently. Partial support for MultiBinding (so far only in one direction), several extensions have been added to standard binders:

Binding to controls

Instead
 <TextBox Text="{Binding ElementName=other, Path=Text}>" 
can write
 <TextBox Text={Binding #other.Text}> 

Asynchronous Binding

Now you can bind to the properties that return Task or IObservable , the binding system will handle everything as it should.

Inversion of value

Have you ever written a primitive converter, only to reverse the boolean value? We can now use the symbol for this ! in the way of binding.
 <Button IsEnabled="{Binding !IsBusy}"> 


Control Patterns in XAML

Previously, templates could only be set from code, now even our standard theme is completely translated to XAML.

Multiselect in listbox

Now ListBox supports selection of several items, and you can bind it to a model in both directions without witches with an ItemContainerStyle like in WPF.

Designer

In our extension to Visual Studio , the following is implemented:


"Direct" properties

PerspexProperty , as well as WPF's DependencyProperty , is a heavyweight thing, so we added support to turn ordinary properties into something that can be bind to. It looks like this:
 public static readonly PerspexProperty<bool> IsFocusedProperty = PerspexProperty.RegisterDirect<InputElement, bool>("IsFocused", o => o.IsFocused); public bool IsFocused { get { return _isFocused; } set { SetAndRaise(IsFocusedProperty, ref _isFocused, value); } } 

What gives support for this property in the implementation of INotifyPropertyChanged and GetObservable .




The framework is developing rapidly, but it is still alpha, so there are a bunch of bugs of all colors and colors, performance problems that nobody has really dealt with, memory can leak in places, that's all. If you find any of the above, please start an issue on the githaba . Currently, the main suppliers of bug reports are the authors of the Core2D and IDE diagram editor for the VitalElement Studio embedded systems, trying to port their applications from WPF to Perspex.

The author of Core2D has made some progress in this field. I think by the end of winter we will roll out the beta, which can be considered something ready for use in small applications.
With questions, you can contact me and in our cozy chat on Gitter (in chat, despite the coziness, only English).

GitHub Repository
Chat in Gitter (in English)
Packages in Nuget: Perspex, Perspex.Desktop, Perspex.Android, Perspex.iOS
Night Build NuGet Feed: www.myget.org/F/perspex-nightly/api/v2/Packages

Source: https://habr.com/ru/post/272151/


All Articles