At Microsoft Build 2017 we shared our vision for Xamarin.Forms 3.0: to enable using Xamarin.Forms in more ways, on more platforms, and faster than ever before. Today, I want to walk you through some of the exciting new features that we’ll be adding to Xamarin.Forms that we know you’re going to love!
You’ve always been able to call native APIs from Xamarin.Forms, but now we’re allowing you to use Xamarin.Forms from a mostly native application.
Whether you’re going all-in on Xamarin.Forms, or just want to use it in your native applications where it benefits you most, we’re enabling all paths; we call this Xamarin.Forms Embedding. Take any ContentPage in XAML or C# and embed it directly into a Xamarin.iOS, Xamarin.Android, or UWP application.
All of your existing Xamarin.Forms UI now has extended use outside of Xamarin.Forms applications.
Here’s how it looks. In your non-Xamarin.Forms application it’s as simple as initializing Forms with the expected parameters for that platform and creating the native counterpart for the
ContentPage using a convenient method. Just like that, you have native controls at your fingertips!
var androidFragment = new MyFormsPage().CreateFragment(this);
var iosViewController = new MyFormsPage().CreateViewController();
var uwpElement = new MyFormsPage().CreateFrameworkElement();
Xamarin.Forms features, such as DependencyService, MessagingCenter, and the data binding system, all still work in this scenario.
Reach More Platforms
Xamarin.Forms is heading to more platforms! Get ready to run on macOS, Linux, and even more Windows applications using WPF. We’ve started with macOS in preview today, but we aren’t stopping there—we’re enabling you to target every desktop platform! Our team is well under way developing for GTK# and WPF.
Speed Boosts and Enhancements
We’ve put Xamarin.Forms under the microscope to identify key targets for making your apps load faster and run quicker, specifically:
- Control Renderers: we continue our work on what we appropriately call Fast Renderers. These refactored renderers avoid creating many intermediate objects and achieve much better performance.
- Layout Compression: when enabled, we optimize your layout at compile time to improve rendering speed and minimize memory usage.
- Binding System: we’re introducing one-time binding mode.
- Flexibility: the popular Web layout system is coming to Xamarin.Forms. We’re introducing a FlexLayout system for building adaptive layouts and implementing a Visual State Manager.
- Styling: we’re polishing up a CSS-inspired styling implementation that’s requested often. You can continue to style your applications as you do today, and if you’re a fan of CSS styling, it will now be a powerful option for you.
Introducing XAML Standard
As announced at Microsoft Build 2017, we’re collaborating with the Windows division on XAML Standard, a way to share XAML as an asset. Xamarin.Forms will fully support XAML Standard and take you to every platform you need to be on.
Frameworks that support XAML Standard will be able to share common XAML based UI definitions. Our goal is for the first version, XAML Standard 1.0, to be available later this year.
Try it Today and Join the Conversation
Here’s where you can get started today on all of the great stuff we’re cooking for Xamarin.Forms 3.0.
Download Xamarin.Forms 3.0 Preview
We’ve posted a preview of Xamarin.Forms Embedding to a new feed and shared our demo code. To get it:
- Add a new source to your NuGet Manager:
- Check Pre-Release
- Select and install the package with the feature name “Embedding”.
- Download the Weather demo application code on GitHub. https://github.com/davidortinau/build2017-new-in-xamarin-forms
When you’re ready, explore the full Xamarin.Forms Roadmap and join the XAML Standard conversation on GitHub.
- Visit the Xamarin.Forms Roadmap and give us your feedback on these announcements.
- Join the XAML Standard conversation at aka.ms/xamlstandard.
- Preview Xamarin.Forms for macOS at blog.xamarin.com/preview-bringing-macos-to-xamarin-forms/.
Watch our full Microsoft Build 2017 Xamarin.Forms session at channel9.msdn.com/events/Build/2017/B8099.