Exploring new properties in Xamarin Forms 3.0

With the release of Xamarin Forms 3.0, everybody is talking about the new features: Flex Layout, css, Visual State Manager and Right to Left. In this article, we are not going to talk about them because there are a lot of articles that already cover those really well. (Here a good one ) .

What we are going to talk about is some new properties, that before this version release a custom renderer, effect or a behavior was needed to achieve this.

Let’s go 

1-Max Length

When developing you got into the need of limiting the text length on an Entry so that doesn’t allow the user to keep writing once limit is reached. To solve it you probably did it with a behavior.

Now you can use MaxLength property in your Entry. Just by adding the property and setting the max number.

The result:

2-Progress bar Color

When using the progress bar we couldn’t change the progress bar color, we only had a default color, so to change the color we did it by using a custom renderer or effect to set the progress color using native apis.

Now we can use the ProgressColor property:

The Result:

3-Picker Font Family

Now you can set a Font to your Picker (Yep, no more custom renderer to do it).

The result:

4-ListView full width separators (iOS)

The iOS lists by default have a margin on the left side, if we have a design that required us to remove this margin probably the easier way was to hide the line separator and add a new line by using a BoxView.

With the latest version and thanks to the platform specifics, now is really easy to do.

Just add the iOS reference:

 xmlns:ios=clr-namespace:Xamarin.Forms.PlatformConfiguration.iOSSpecific;assembly=Xamarin.Forms.Core
           

Then add the property to your list  ios:ListView.SeparatorStyle=FullWidth

The result:

5-Ime Options (Android)

This feature is about customizing the return key on Android keyboard when an entry has focus.

The default one looks like this:

If we want to change it, we do something similar as we did on iOS before by using the platform specifics we can use the property ImeOption.

Just add the Android reference:

xmlns:android=clr-namespace:Xamarin.Forms.PlatformConfiguration.AndroidSpecific;assembly=Xamarin.Forms.Core
             

Then add the property to your entry android:Entry.ImeOptions=Search 

The result:

Here is how to do it in the code behind and also the other ImeFlags you can use:

PDT:

This feature will be expanded to support iOS and UWP in the v3.1.0, more info here.

 

I just mentioned my favorites, but there are more useful properties. For more, you can check the release note here.

Happy coding! 🙂

You may also like

6 Comments

  1. Hi,
    “ios:ListView.” does not exist for me… But Entry, Page, Picker, NavPage and ScrollView.

    What am I doing wrong?

    1. Are you adding the reference

      xmlns:ios=“clr-namespace:Xamarin.Forms.PlatformConfiguration.iOSSpecific;assembly=Xamarin.Forms.Core“

      ??

      1. Hi, yes I do.

        https://ibb.co/SBfvH9F

        My Workaround to add specific Code for now. I do write this in Codebehind to an object.

        “On().SetSeparatorStyle(Xamarin.Forms.PlatformConfiguration.iOSSpecific.SeparatorStyle.FullWidth);”

        It works fine, but I get errors when I write specifics in XAML.

        best regards