Skip to content

2.2.0

Compare
Choose a tag to compare
@cwensley cwensley released this 29 Dec 05:08

We are proud to announce that Eto.Forms v2.2 is now released!

This release brings much better Xaml support, and huge advancements in the Visual Studio and Xamarin Studio tooling with the new visual designer.

There have been 163 commits and 679 files changed since v2.1.

Visual Studio & Xamarin Studio addins

Get started with Eto.Forms quickly using the new addins here.

Visual Designer

Both Visual Studio and Xamarin Studio/Monodevelop addins now support split screen form preview for Xaml, Json, and Code (C#, F#, or VB.NET) view definitions. Building your cross platform views has never been easier!

Visual Studio 2013 / 2015 Xamarin Studio / Monodevelop
Form preview in Visual Studio Form preview in Xamarin Studio

Xaml Autocomplete

Both Visual Studio and Xamarin Studio now have full autocomplete for xaml views, providing you with faster development of views while building them.

Visual Studio 2013 / 2015 Xamarin Studio / Monodevelop
Xaml Autocomplete in Visual Studio Xaml Autocomplete in Xamarin Studio

New template options

Both addins now provide more options when creating a new application, like whether you want to use Xaml, Json, or Code preview by default.

Xamarin Forms template options

New Features

Xaml is now Portable

The Eto.Serialization.Xaml now uses a port of mono's System.Xaml to PCL called Portable.Xaml, with many fixed bugs and performance improvements. This finally allows proper support of markup extensions such as {Binding <property>}, {Resource ...}, etc.

This new Xaml engine is used for all platforms including windows to improve compatibility.

Xaml 'On' Markup Extension

In many cases you may want to tweak the UI, such as padding or sizes for certain platforms. A new markup extension for Xaml allows you to do this very easily and supports any property.

For example:

<StackLayout Padding="{On 10, Mac=5, Windows=10, Gtk=3}">...

The supported options for platforms/operating systems are listed in the OnExtension class. The platforms (Gtk, Mac, WinForms, Wpf) take precidence over the operating systems (Osx, Windows, Linux) and target device (Desktop, Mobile)

CommandParameter support for ICommand binding

Controls with ICommand binding like the Button, LinkButton, ButtonMenuItem, etc now have a CommandParameter that you can use to pass to the command when executing, which should be familiar to developers coming from WPF.

RelayCommand<T> is now also available to easily set up commands in your view model, which passes the command parameter of a particular type. For example:

public class MyModel
{
    public ICommand MyCommand { get; set; } 
        = new RelayCommand<string>(p => MessageBox.Show("Clicked: " + p));
}

//...

var myButton = new Button { CommandParameter = "Something" };
myButton.BindDataContext(c => c.Command, (MyModel m) => m.MyCommand);

Parent/Child logical tree vs. visual tree

The Parent/Child relationship of controls are now based on the logical hierarchy. New Control.VisualChildren and Control.VisualParent properties have been added to represent the visual tree. The layout controls have been updated to build the logical tree immediately as children are added/removed, so you can use the FindChild or the new FindParent helpers without waiting for the control(s) to be loaded on the form.

This is especially useful when loading a definition from Xaml or Json, where you can now find children by ID or other criteria to perform additional setup before the form is loaded.

New CustomCell and PropertyCell

The GridView and TreeGridView now support a new CustomCell which can be used to display custom controls on the grid for platforms that support it. The PropertyCell is a subclass of the CustomCell and implements an easy way to present different controls depending on the row value, usually based on its type.

Note that some platforms (e.g. WinForms and Gtk) still require a paint method for displaying the data, which the CustomCell provides for. But for WPF and Mac, the custom control can be used for the cell view and edit.

Check out the CustomCell and PropertyCell samples for how to use these new cells.

SystemColors

You can now get standard system colors using the new SystemColors static class, such as Control, ControlText, ControlBackground (e.g. background of a text box), DisabledText, Highlight, HighlightText, and WindowBackground. Note: in GTK, these may not return the correct result as there's no way to get the theme's colours (help getting this working correctly, if possible, would be appreciated).