⬆️ ⬇️

Perspex - cross-platform UI framework with XAML and bindings

TL; DR: WPF cross-platform clone. It differs favorably from other attempts to do something with XAML by having its own rendering system with interchangeable backends (Direct2D and Cairo are now supported). In the presence of an inspector, designer (see video). Binding made on steroids called ReactiveExtensions (old style can also be used). Able to work with Windows / Linux / MacOS, support for mobile platforms is planned to be added at the beginning of next year by means of drawing via MonoGame.







The current status of the project is the second alpha. That is, it is already possible to feel, but in production it’s still a bit early. There is a solid set of working controls: Button, ToggleButton, CheckBox, HtmlLabel, RadioButton, Canvas, ContentControl, Control, Controls, Deck, Decorator, DropDown, Image, ItemsControl, ListBox, ListBoxItem, Menu, MenuItem, Panel, StackPanel, Grid, Primitives .Popup, Primitives. SelectingItemsControl, Primitives.TabStrip, Primitives.TemplatedControl, Primitives.Thumb, Primitives.Track, ScrollViewer, TabControl, TabItem, TextBlock, TextBox, ToolTip, TreeView. DockPanel in the closing window of the second alpha release is not climbed, is available in night assemblies. The native view for them will be made in about the same way as in WPF - by creating default themes for common platforms. Doing garbage with writing pieces of platform-dependent UI-code, as you need to do in the case of Xamarin.Forms when using Perspex is not necessary.



The type system and drawing API are quite similar to WPF, for example, I managed to port HtmlLabel from HtmlRenderer without any special problems.

')

The system of styles is somewhat expanded compared to WPF. A control can have several styles with different selectors, for example: a pointerover, which allows styling like CSS.



Intellisense in the designer so far allows auto-completion of the names and properties of the entities embedded in Perspex, but the current system of its implementation will further allow both the connection via the clr-namespace and the simplest addition to binding. For something more complicated, you need to build a full-fledged AST, and this is a fairly large amount of work.



It is easiest to try in action by installing the extension for Visual Studio and creating a project from the attached template .



GitHub Repository

Cozy chat in Gitter (in English)

NuGet Package

Night Build NuGet Feed: www.myget.org/F/perspex-nightly/api/v2/Packages

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



All Articles