Xamarin.Forms 5 Preview: Advanced UI Controls for Beautiful Apps

David Ortinau

Xamarin.Forms 5 brings to stable release features that you have seen in preview over the latest several 4.x releases. This includes solid and gradient Brushes, CarouselView, drag-and-drop, RadioButton, Shapes, and SwipeView. These new features inject new creative potential for your application designs to create beautiful, interactive experiences.

Let’s look at those highlights, and then a quick checklist of what you should review as you get started with the Xamarin.Forms 5 pre-release.

Beautiful Design with Brushes, Shapes, and Paths

With brushes you can now easily paint gradients anywhere you need them. Shapes and paths allow you to draw all the rounded corners and even oddly shaped parts of your UI by using the platform graphics APIs which adds no size to your final applications. You can use geometries to clip any visual element, which makes it very easy to get the highly sought-after circle image.

Image of two apps with custom shapes and gradients

For more information, check out the brushes documentation, shapes documentation, blog for shapes and paths, and the blog introducing brushes.

Any UI with Templating

While RadioButton isn’t perhaps the most exciting form control, its use of control templating to radically alter the look of the design foreshadows where we can take control extensibility in future iterations. The RadioButton control now takes any content so you can completely control the look and behavior of the control. In its most simple usage, you can provide just text (left image), and in more advanced usage add a control template (right image) to match a Fluent UI design.

Image of radio buttons in a classic style and templated with calendar views

Control templates have actually been part of Xamarin.Forms since version 2. Broadening this capability beyond custom controls to the provided native controls unlocks new potential.

More Interactive Controls with CarouselView, SwipeView, and Drag-and-drop

CarouselView supports control of the looping, supports various visual states to transform the CurrentItem, PreviousItem, NextItem, and DefaultItem with VisualStateManager. PeekAreaInsets can be used to set how much of the previous and next items should encroach on the current item in view. It also includes an EmptyView, a property to attach an IndicatorView, and so much more. For details on how to use these features and others, visit the CarouselView documentation.

SwipeView wraps any control and layout to add contextual buttons and commands like you might see in a list. Drag-and-drop gestures allow you to add that gesture to any UI view and control what can accept the drop, whether inside the application, or outside. This is especially useful on the Surface Duo when you have two apps open.

Phone with list of characters being swiped from the right.

Learn more from the SwipeView documentation, drag-and-drop documentation, CarouselView documentation, and from the CarouselView introduction blog post.

Thank You Reviewers

This release also included several community reviewers that played a significant role in helping us get through so many bug fixes and enhancements for this release. Code contributors are always celebrated, and these community members have gone the additional step to help make sure those contributions make it more quickly into the product. Join us in celebrating these awesome individuals!

Interested in participating? Join us on the .NET Discord in the #xamarin-forms channel.

Getting Ready for Xamarin.Forms 5

As you look at upgrading your applications to Xamarin.Forms 5, there are some changes and removals to be aware of first. For a complete list, review the release notes. Most notably:

  • Visual Studio 2019 is the minimum version to use
  • MasterDetailPage and properties have been renamed
  • UIWebView has been removed to address Apple restrictions
  • MediaElement and Expander have been moved to the Xamarin Community Toolkit. C# UI is to follow.
  • (Preview) DataPages and Theme packages have been removed from the NuGet release

For more details on these changes visit the release notes.

Please take a few minutes to safely branch and upgrade your projects to this pre-release of Xamarin.Forms 5, and let us know what needs attention by reporting an issue on GitHub.

Browse the awesome documentation for all of the great new features in Xamarin.Forms 5: