Xamarin.Forms 4.7: Grid Column & Row Definitions, Multi-Bindings, Shapes & Paths, and More!

This post has been republished via RSS; it originally appeared at: Microsoft Developer Blogs.

Today, the Xamarin.Forms team is releasing Xamarin.Forms 4.7 with a collection of feature additions and improvements. These new features will let you unleash your full creative abilities when developing Xamarin.Forms applications. Simplified Grid Row & Column Definitions Before Xamarin.Forms 4.7, you would have to specify each column and row definition separately. This process was tedious and repetitive, thus leading to an overall slower design time. Thanks to Morten Nielsen's enhancement request, column and row definitions have been simplified. Take this example below: While this code is practical, it is overly complex. To help simplify the grid definition process, the Xamarin.Forms team has created a simplified syntax. Shorter, easier. Thanks, Morten! Multi-Bindings The next great feature added to Xamarin.Forms in 4.7 thanks to the work of Peter Moore is multi-binding. Multi-binding allows you to connect a target property to a list of source properties and then apply logic to produce a value with the inputs specified. A simple and powerful way to use multi-binding is the ability to format any multi-binding result that's displayed as a string with the StringFormat property. This property can be set to a standard .NET formatting string, with placeholders, that specifies how to format the multi-binding result. For example, let's say you wanted to create a label of a user's full name. You can use multi-bindings combined with StringFormat to create a single label that contains the user's full name, regardless of where the user inputs their forename, middle name, or surname. An example of this can be seen below: Multi-binding is even more powerful when you add MultiValueConverters. Shapes & Paths Today in Xamarin.Forms we are releasing experimental support for shapes and paths. Currently, we have Views such as BoxView or Frames that allow you to create rectangles or ellipses. However, we recognize that you want the ability to create any shape that best fits your application design. Shapes & paths in Xamarin.Forms allow you to create custom, unique designs to better fit your user interfaces. David Ortinau made an amazing login screen example to show what shapes and paths can add to your apps. There are many new features leveraged when creating this application. First, a custom image shape was created using the clip property. In this example, an ellipse shape is supplied to the image clip property. However, you can use any shape as the clipping shape. Another new feature shown in this example is drawing a path to create a custom login shape, and then the login button itself. In this case, a path view was defined within the XAML page, and then the data property was populated with path data that defines the custom shape. It’s important to note that this feature is shipping under the experimental flag, and thus Shapes_Experimental must be added to your App.xaml.cs constructor. For much more information on using shapes and paths, check out the documentation. Light & Dark mode With Xamarin.Forms 4.7 the Xamarin team is releasing updates to style light and dark mode. Users now have even more control to manage the theme of their applications through the use of UserAppTheme. Before you get started, set the experimental flag for AppTheme_Experimental. You can now set the style of your application with AppThemeBinding, and see your UI update at runtime as the OS changes theme. To do so, set the value of the property you are binding to using AppThemeBinding, as seen below: Note, if you were using AppThemeColor in a previous version, you'll need to update to this. You can also set the app theme regardless of what your operating system's theme is currently set to. For example, if your phone is in Light mode, but you want the specific app you are using to be in dark mode, then you can set: To keep the app theme on light mode regardless of your operating system's application theme, set your application to: If you want your application to default to your operating system's application theme, set your application to: Read more about Light and Dark mode on the Xamarin.Forms docs. Featured Contributor Every release we have dozens of contributors, and several of whom we mention in our blogs. Today we are starting a featured spotlight to learn a little bit more about a contributor, so today let's meet Fredy. What's your name? Fredy Adriano Jimenez Martinez Where are you based? I'm Cuban, but living in Mexico. How long have you been using Xamarin.Forms? 10 months Where can people find you online? GitHub Get Started Today Update your projects from your favorite NuGet package manager today! Take advantage of this latest release. Share your projects and progress with us online. We'd love your feedback on Xamarin Forms. Please open issues on GitHub for any additional enhancements or issues to discuss. For more information on this release check the resources below. Xamarin.Forms 4.7 Release Notes Docs TypeConverter on Grid Column and Row Definitions Multi-Bindings Shapes & Paths Light & Dark Mode Login Screen Example *. Light and Dark Example

Leave a Reply

Your email address will not be published. Required fields are marked *

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.