Big Changes in Xamarin.Forms 4.0 Prompt Early Preview
There are so many big changes coming in Xamarin.Forms 4.0 that Microsoft has issued an earlier-than-usual preview to gather feedback on the cross-platform UI toolkit for .NET developers coding iOS and Android apps.
Microsoft unveiled the Xamarin.Forms 4.0 early preview at its recent Connect conference, right along with the release of Xamarin.Forms 3.4.0, which you can read about here.
"Through countless interviews, conversations, and surveys, we have heard your voice loud and clear," said Microsoft's David Ortinau in a blog post announcing the early preview of Xamarin.Forms 4.0. "You want Xamarin.Forms to be easier to use 'out of the box', navigation to be ever present and easier to control, to have a more consistent design across iOS and Android, and to have a faster, more flexible list control."
To help with that, Ortinau called out three main new features: Shell, Visual and CollectionView.
Here's a look at each:
Xamarin.Forms Shell provides an easier way for developers to express the structure and navigation of an app in a single file. It uses three tiers of elements to describe an application, and Microsoft said developers can think of it "as the evolution of MasterDetailPage, NavigationPage and TabbedPage."
It basically acts as a container for applications, providing UI features required by most projects. Microsoft said its functionality includes:
- A single place to describe the visual structure of an application.
- A common navigation user interface.
- A navigation service with deep linking.
- An integrated search handler.
"This functionality reduces the complexity of applications, while increasing developer productivity," Microsoft said. "In addition, Shell is written with rendering speed and memory consumption in mind."
Microsoft published a Tailwind Traders Mobile Reference App on GitHub to showcase the feature.
Visual is a new way for mobile developers to attain consistent UI design across iOS and Android apps. It simplifies the laborious process of tweaking native projects to get them to look similar, a process that Microsoft said was previously done through the use of "styles, effects, custom renderers, and a generous allotment of time."
That process will reportedly be made easier by suppling a consistent control theme by default. In these early stages, this new approach at first supports only
an implementation of Google's Material Design scheme, specifically affecting only Button, Entry, Frame and ProgressBar controls. In contrasting an Android and iOS app in a graphic (see figure below) Microsoft's Joseph Hill said "there is still lots of work to be done to unify the default design, and we will continue to improve this as we work through the Xamarin.Forms 4.0 preview cycle."
And the functionality isn't limited to just making controls look the same. "Visual goes beyond styles to also unify behavior and when necessary providing highly customize renderers," Microsoft said.
CollectionView "is the flexible and performant list control that you've been asking for," Microsoft said. This control, designed to succeed the venerable ListView, was deemed worthy of its own blog post.
There, Paul DiPietro said it improves on ListView's design by reducing technical complexity and providing more layout and functionality flexibility.
Microsoft said the new control differs from ListView in the following ways:
- CollectionView has no concept of cells. Instead, data templates are used to define the appearance of each item of data in the list.
- CollectionView reduces the API surface of ListView. Many properties and events from ListView are not present in CollectionView.
- CollectionView has a flexible layout model, which allows data to be presented vertically or horizontally, in a list or a grid.
To help developers get a handle on the new control, a CollectionViewSample was published on GitHub.
All of the above and much more is explained in greater detail in the Xamarin.Forms 4.0.0 Early Preview release notes.
About the Author
David Ramel is an editor and writer for Converge360.