Xamarin.Forms 1.3.4, which was released in mid-February, provides some follow-on enhancement and bug fixes to January’s 1.3 release. The main attraction in release 1.3.4 are the features introduced in 1.3, which for the most part are aimed at making designers and developers more efficient and apps more consistent. According to Xamarin’s Craig Dunn, 1.3 was a “huge release” for Xamarin.Forms.
Xamarin provides a unified framework for writing apps using software that’s shared on Android, iOS and Windows devices. Xamarin.Forms is the portion of that framework that provides a standard set of user interface controls, such as buttons and entry fields. Although these controls retain their platform-specific look and feel (so that a Xamarin.Forms button looks like the buttons in native Android apps), little or no platform-specific code needs to be written by the app developer. Like other parts of the Xamarin framework, a C# API is provided for Xamarin.Forms. The XAML markup language can optionally be used to specify user interface appearance.
Although Xamarin.Forms is still a relatively young product at less than a year old, it already offers a rich set of controls and capabilities. The fact that Xamarin is adding usability enhancements at this stage is a testament to the robustness of the platform.
Let’s look at the top Xamarin 1.4 enhancements in detail.
- Styles. Anyone who has used XAML to specify anything beyond the simplest user interface can testify to the tediousness of duplicating code that defines color, font size and other aspects of appearance for every UI object. The new Styles features allows a common set of appearance properties to be grouped as a style and then reused for multiple objects. For example, all of the entry fields in an app can be set to display red text in a medium-sized font. Besides making XAML files more concise, the Styles feature makes it easier to quickly experiment with different looks for an app. Developers who prefer C# to XAML for UI definition can still take advantage of the Styles feature.
- Triggers. Besides using Styles to ensure a consistent UI appearance, developers can take advantage of the new Triggers feature to tie appearance properties to interactive events. For instance, an entry field can be made to automatically use a large-sized font when it gets focus.
- New Application Class. This new class replaces the old application class, which was essentially only a shell used to get an app started. By subclassing the new class, developers can provide cross-platform handlers for app lifecycle events like startup, sleep and resume instead of having to write platform-specific code. A properties dictionary that lives on the application object can be used to store persistent data prior to app sleep and restore it after app resume.
- Navigation Stack. Improvements to the page navigation mechanism known as the navigation stack make it easier to dynamically insert, remove and reorder app content pages.
The main addition to 1.3 in the 1.3.4 release is an improved layout engine for the Stack Layout, a UI component that can be used to organize other controls in rows and columns. Layout is one of the biggest challenges when it comes to cross-platform UI development, so it’s good to know that Xamarin is focused in this area. There are also several bug fixes, including fixes for regressions introduced in 1.3. Developers who want to take advantage of all the exciting new features in version 1.3 should be sure to download 1.3.4 and each follow version in order to avoid many of the regressions and issues that are an inevitable part of any software release.
If you’re interested in Xamarin and would like to know more, also read Getting Started with Xamarin and 5 Reasons to Use Xamarin. As always, let Seamgen know if you have any questions or would like to get started on a Xamarin project.