Uno Platform 2.1 available now – x:Bind, TwoPaneView and more
Uno Platform
Posted on April 9, 2020
Uno Platform 2.1 release is packed with over 50 new features allowing for increased productivity as well as getting you up and running with Surface Duo. In addition to bigger milestones such as x:Bind, the TwoPaneView and NumberBox controls we also shipped another 50 new features and closed 45 issues you raised. Without further ado:
x:Bind functions
Uno has been supporting some form of x:Bind markup for properties, binding to functions were a big ask from users of Uno, as it allows for invoking methods from code behind very easily.
Two of the largest use of x:Bind functions is to reduce the use of converters, and the use of static properties. Another use of the x:Bind is familiar to WPF developers, where binding to multiple properties is also available.
You’ll find below some examples of the x:Bind feature.
Member Function, to make a string upper case:
<TextBlock Text="{x:Bind MyProperty.ToUpper()}" />
Static type fields or properties OneTime binding:
<TextBlock Text="{x:Bind local:StaticType.PropertyIntValue}" />
OneWay local member function with multiple observable parameters:
<TextBlock Text="{x:Bind Multiply(slider1.Value, slider2.Value), Mode=OneWay}" />
Literal boolean parameters:
<TextBlock Text="{x:Bind BoolFunc(x:False)}" />
Literal numeric value:
<TextBlock Text="{x:Bind Add(InstanceProperty, 42.42)}" />
Use of system functions such as:
<TextBlock Text="{x:Bind sys:String.Format('Formatted {0}', MyProperty), Mode=OneWay}" />
Which also works with multi parameters formatting:
<TextBlock Text="{x:Bind sys:String.Format(x:Null, 'slider1: {0}, slider2:{1}', slider1.Value, slider2.Value), Mode=OneWay}" />
Or DateTime parsing:
<CalendarDatePicker Date="{x:Bind sys:DateTime.Parse(TextBlock1.Text)}" />
Uno also supports two-way BindBack:
<TextBlock Text="{x:Bind sys:String.Format('{0}', MyInteger), BindBack=BindBackMyInteger, Mode=TwoWay}" />
where this method is available in the control:
public void BindBackMyInteger(string text){ MyInteger = int.Parse(text);}
The Uno docs site provides a more detailed documentation on this feature.
Surface Duo and WinUI TwoPaneView
The WinUI 2.3 TwoPaneView is a Windows 10 specific control provides the ability to layout content in two panes. It behaves like a dual ContentControl, based on a set of parameters such as Pane length, tall and wide configuration modes and pane priorities to display content based on the available window space.
We have ported TwoPaneView so you are able to use it with Surface Duo. You can see much more about TwoPaneView at the blog dedicated to it.
WinUI 2.3 NumberBox
The NumberBox control is a very powerful control that the WinUI team created, which we ported it over to Uno. It supports lots of modes, with min and max values, steps, as well as the ability to enter quick expressions:
Other significant updates
You’ll find the complete list of changes in the release notes over on GitHub releases, as the support for Grid.ColumnSpacing and Grid.RowSpacing, multitouch pointers support, support for UIElement.RightTapped and Holding.
Thanks to Morten Nielsen, the support for templates tags in the Visual Studio 2019 wizard has been added, to make it easier to discover the templates:
Thank you to all our contributors for the hard work they’re putting into improving Uno !
Next Steps
We are already working on 2.2 release and we hope to ship it within next 45 days. In the meantime, if you find issues, please let us know by opening one here.
If you are new to the Uno Platform, you may want to run through the Getting Started tutorial. This will ensure you have the correct environment set up and that you have the latest release of Uno. If you have already worked with Uno, you may want to update your Uno package via your Visual Studio NuGet package manager.
Jerome Laban, on behalf of Uno Platform team
The post Uno Platform 2.1 available now – x:Bind, TwoPaneView and more appeared first on Uno Platform.
Posted on April 9, 2020
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.