Update to Xamarin.Forms 3.0 Pre-Release Available Today!

David Ortinau

We’re excited to announce that the latest update to the Xamarin.Forms 3.0 Pre-release is now available! Help us make this our best Xamarin.Forms release ever by updating today and giving it a try. Here’s the breakdown of what you can expect in this release.

Overview

Xamarin.Forms 3.0 delivers stability, performance, and features focusing on making it easier to create beautiful applications that work on a variety of devices. We’re now building with .NET Standard 2.0, using the magic of multi-targeting, while still supporting the PCL profiles and other .NET Standard versions you may need. Notice how much faster your projects load when you use .NET Standard project types!

We’ve gained some performance in our never-ending pursuit of faster builds, instant cold starts, and runtime speed. Xamarin.Forms 3.0 opens up more functionality, includes some great community contributions, and even sheds a little overhead as we sunset Windows Phone and WinRT. For the best Windows experience, you’ll want to use UWP. Our incredible community has taken up the challenge of older versions of Windows, and Xamarin.Forms 3.0 now includes the early preview of WPF support.

Feature Highlights

Based on community surveys, looking at your apps, and many one-on-one conversations with developers, we know that a significant number of you come to Xamarin.Forms from other mobile and desktop XAML experiences. We want to make your experience as productive as possible while using the parts you’re already familiar with. This continues in 3.0 with the introduction of the Visual State Manager.

“Share your experiences with us! Your feedback matters, and we need to hear from you. If you have a story to share, whether to celebrate your success or to show us where you’d like us to improve, send me an email.”

– Dave
Senior Program Manager, Xamarin.Forms
david.ortinau@microsoft.com

There are a significant number of mostly ASP.NET and web developers using Xamarin.Forms today with little-to-no desktop experience. In light of that finding, and after looking at how web developers are productive in their own workflows, we’ve identified two features to add to Xamarin.Forms: FlexLayout and CSS. Xamarin.Forms 3.0 introduces both of these features without compromising the existing XAML experience desktop developers have come to know and love.

To add to that, Right-to-Left support and a ton of quality improvements have also been included in this 3.0 release! Let’s explore a quick overview of each feature mentioned.

Visual State Manager

XAML developers using UWP have been productive managing the state of their controls by using a VisualStateManager. Common use cases are to set the valid or invalid state of form controls, when something is enabled or disabled, or even move a control through multiple states, such as a password strength indicator. For more examples of this in action, check out the login page of this sample app.

Note: This is the first iteration of VisualStateManager in Xamarin.Forms 3.0. We’re considering how to make this more useful to you in future iterations. Please send us your thoughts.

FlexLayout: Distribution and Adaptability

Inspired by the popular FlexBox, FlexLayout introduces a new layout for Xamarin.Forms. FlexLayout gives you superior control over how children are distributed and how your layouts adapt to various sizes and dimensions. This layout also promotes a flatter UI hierarchy, a best practice for creating performant interfaces.

Since the introduction of basic CSS support, you can now grab web-based CSS snippets for FlexBox in your Xamarin.Forms apps with little-to-no adjustment.

For examples of the types of layouts you might create with FlexLayout, and how to implement them, explore this sample app on GitHub, as well as our FlexLayout pull request, which describes the properties available to you.

StyleSheets: The Power of CSS in Your Apps

Xamarin.Forms developers have long been productive expressing Styles via XAML, and this remains unchanged. In 3.0, CSS introduces a complimentary way to express Styles together with XAML Styles and, in some cases, all by itself. For a list of the Style properties available in StyleSheets, check out the pull request.

StyleSheets can be added to your XAML by loading a separate *.css file or inline.

<ContentPage x:Class="...">
  <ContentPage.Resources>
    <StyleSheet Source="appresources/style.css" />
  </ContentPage.Resources>
</ContentPage>

Notice the nice, collapsed ResourceDictionary syntax. We teased this as a “coming soon” enhancement in the previous post Better Resource Organization. Be sure to check that out.

<ContentPage x:Class="...">
  <ContentPage.Resources>
    <StyleSheet>
<![CDATA[
^contentpage {
    background-color: orange;
    padding: 20;
}

stacklayout > * {
    margin: 3;
}
]]>
    </StyleSheet>
  </ContentPage.Resources>
</ContentPage>

Several of these example layouts demonstrate various ways to express styles.

Right-To-Left Localization

While it’s always been possible to support right-to-left scripts in Xamarin.Forms (using effects, custom layouts, and custom renderers), it hasn’t always been as easy as it should be. To that end, we’ve now surfaced the necessary API to easily read and use the user’s regional settings, as well as updated our layouts and controls to respect those settings. It’s really as simple as doing the following in your XAML for layouts and controls:

FlowDirection="{Binding Device.FlowDirection}"

New Platform Previews

This version of Xamarin.Forms ships with new and updated platform previews, including Tizen, GTK#, macOS, and WPF. A huge thanks to our community and partners for these incredible contributions!

Each of these are in varying stages of maturity, so check the platform support page on our wiki for details.

Begin exploring today!

Check out the release notes for a rundown of the full list of enhancements and fixes. Xamarin.Forms 3.0 pre-release is on NuGet now. To update, check for pre-release options in your NuGet manager and add the package to all of your solutions projects. Reboot the IDE for a clean start, and get going!

If you’re upgrading from an older version of Xamarin.Forms, check that your Android project is using target framework 7.0 or greater and Android Support Libraries 25 or newer. For additional details on resolving your Android dependencies, refer to the 2.5.0 stable release notes.

Please file any issues you discover for us to troubleshoot and address.

0 comments

Discussion is closed.

Feedback usabilla icon