{"id":37480,"date":"2018-07-18T15:27:37","date_gmt":"2018-07-18T19:27:37","guid":{"rendered":"https:\/\/blog.xamarin.com\/?p=37480"},"modified":"2019-03-25T14:32:00","modified_gmt":"2019-03-25T22:32:00","slug":"xamarin-forms-3-1-improvments","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/xamarin\/xamarin-forms-3-1-improvments\/","title":{"rendered":"Xamarin.Forms 3.1: Improving the Little Things"},"content":{"rendered":"<p>\t\t\t\tEarlier this year, we surveyed Xamarin.Forms developers about the kinds of custom controls and extra platform code being written repeatedly that should be considered for support \u201cin the box\u201d. From these conversations, we created an initiative to deliver as many as we could in the next several releases. Just six weeks after shipping Xamarin.Forms 3.0 at Build 2018, we are excited to introduce Xamarin.Forms 3.1 with a batch of those enhancements to make your lives easier. Now you can spend more time investing in your applications! In this article, we&#8217;ll take a look at some of the highlights.<\/p>\n<h2>Xamarin.Forms 3.1<\/h2>\n<p><img decoding=\"async\" class=\"aligncenter wp-image-37485\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/44\/2019\/03\/android_tab_position.png\" alt=\"\" width=\"1000\" height=\"873\" \/><\/p>\n<h3 id=\"androidbottomtabs\">Android Bottom Tabs<\/h3>\n<p>Google introduced the <code>BottomNavigationView<\/code> in Android Support Library 25, thus removing the limitation that tabs could only be at the top of the interface. Thankfully this was instantly possible for Xamarin.Forms by writing a custom renderer. We worked with contributor <a href=\"https:\/\/twitter.com\/mikescandy\">Michele Scandura<\/a>\u00a0to make this\u00a0even easier by introducing a platform specific to set your preference on any <code>TabbedPage<\/code>.<\/p>\n<pre class=\"marking:true lang:xhtml mark:6-9 decode:true \">&lt;TabbedPage xmlns=\"http:\/\/xamarin.com\/schemas\/2014\/forms\" \r\n            xmlns:x=\"http:\/\/schemas.microsoft.com\/winfx\/2009\/xaml\" \r\n            xmlns:views=\"clr-namespace:TheLittleThingsPlayground.Views\" \r\n            x:Class=\"TheLittleThingsPlayground.Views.MainPage\"\r\n            BarBackgroundColor=\"#F1F1F1\"\r\n            xmlns:android=\"clr-namespace:Xamarin.Forms.PlatformConfiguration.AndroidSpecific;assembly=Xamarin.Forms.Core\"\r\n            android:TabbedPage.ToolbarPlacement=\"Bottom\"\r\n            android:TabbedPage.BarItemColor=\"#666666\"\r\n            android:TabbedPage.BarSelectedItemColor=\"Black\"&gt;<\/pre>\n<p>Above you only need to add the namespace for Android, and then set the <code>TabbedPage.ToolbarPlacement<\/code> to &#8220;Bottom&#8221;. A few other properties are provided for your convenience to style the bar in its new position outside of the <code>NavigationPage<\/code> where it resides up top.<\/p>\n<ul>\n<li>BarItemColor<\/li>\n<li>BarSelectedItemColor<\/li>\n<\/ul>\n<p>We recommend reading through <a href=\"http:\/\/twitter.com\/jamesmontemagno\">James Montemagno<\/a>&#8216;s <a href=\"https:\/\/montemagno.com\/xamarin-forms-official-bottom-navigation-bottom-tabs-on-android\/\">recent blog<\/a> that walks through each property to fully customize bottom tabs on Android.<\/p>\n<blockquote style=\"background-color: #f1f1f1;text-align: left;font-size: medium;padding: 10px 20px;border-left: 3px solid #39e\">\n<p style=\"font-size: 15px\">Note: tab positioning may only be set once on a <code>TabbedPage<\/code> instance. Any changes at runtime will result in an error.<\/p>\n<\/blockquote>\n<h3 id=\"variousentryandeditorenhancements\">Various Entry and Editor Enhancements<\/h3>\n<p>It is super easy now to set the auto-capitalization on an <code>Entry<\/code>. One can also easily control text prediction and even auto-resize an <code>Editor<\/code> as your user types.<\/p>\n<h4>Auto-Capitalization<\/h4>\n<p>Sometimes you don\u2019t want the mobile keyboard to capitalize the user\u2019s entry. For example, when entering a username or email address. You can now control capitalization via an additional keyboard flag. Done via XAML it looks like this:<\/p>\n<pre class=\"marking:true lang:xhtml mark:5 decode:true \">&lt;Entry Placeholder=\"Enter your text\" HeightRequest=\"40\"&gt;\r\n    &lt;Entry.Keyboard&gt;\r\n        &lt;Keyboard x:FactoryMethod=\"Create\"&gt;\r\n            &lt;x:Arguments&gt;\r\n                &lt;KeyboardFlags&gt;CapitalizeNone&lt;\/KeyboardFlags&gt;\r\n            &lt;\/x:Arguments&gt;\r\n        &lt;\/Keyboard&gt;\r\n    &lt;\/Entry.Keyboard&gt;\r\n&lt;\/Entry&gt;<\/pre>\n<p>Documentation: <a href=\"https:\/\/docs.microsoft.com\/en-us\/dotnet\/api\/Xamarin.Forms.KeyboardFlags?view=xamarin-forms\">Keyboard Flags<\/a>.<\/p>\n<h4>Return Button<\/h4>\n<p>With the new \u201cReturnType\u201d property on <code>Entry<\/code> you can set the \u201cdone\u201d or \u201creturn\u201d key you want displayed on the keyboard when that <code>Entry<\/code> is in focus. For example, if you want to display the \u201csend\u201d icon you would copy the following code:<\/p>\n<pre class=\"lang:xhtml decode:true \">&lt;Entry Placeholder=\"Enter your text\" HeightRequest=\"40\" ReturnType=\"Send\" \/&gt;\r\n<\/pre>\n<p>Documentation: <a href=\"https:\/\/docs.microsoft.com\/en-us\/dotnet\/api\/xamarin.forms.returntype?view=xamarin-forms\">ReturnType<\/a><\/p>\n<h3>Text Prediction<\/h3>\n<p>Have you ever wanted to just disable the text prediction that Android or iOS provides by default? If you\u2019ve ever done this yourself, then you\u2019ve likely questioned why you had to write so much code to update a single property. No more! We\u2019ve added a property to <code>Entry<\/code> specifically for this very purpose:<\/p>\n<pre class=\"lang:xhtml decode:true \">&lt;Entry Placeholder=\"Enter your text\" IsTextPredictionEnabled=\"false\" HeightRequest=\"40\"\/&gt;\r\n<\/pre>\n<h4>Auto-Resize<\/h4>\n<p>When you have a multi-line entry, known in Xamarin.Forms as an <code>Editor<\/code>, and you want the user to be able to continue typing additional rows while the control automatically grows, you can now do just that with a single property.<\/p>\n<pre class=\"lang:xhtml decode:true \">&lt;Editor Text=\"Type here\" AutoSize=\"TextChanges\"\/&gt;<\/pre>\n<p>Documentation: <a href=\"https:\/\/docs.microsoft.com\/en-us\/dotnet\/api\/xamarin.forms.editorautosizeoption?view=xamarin-forms\">EditorAutoSizeOption<\/a><\/p>\n<p><img decoding=\"async\" class=\"aligncenter size-full wp-image-37486\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/44\/2019\/03\/2018-07-18_07-30-51_2.gif\" alt=\"\" width=\"281\" height=\"500\" \/><\/p>\n<h2 id=\"updatetoday\">Update Today!<\/h2>\n<p>Xamarin.Forms 3.1.0 is available today via NuGet.\u00a0To get the latest benefits, update your project NuGet to <a href=\"https:\/\/www.nuget.org\/packages\/Xamarin.Forms\/3.1.0.637273\" target=\"_blank\" rel=\"noopener\">Xamarin.Forms 3.1.0<\/a>, the latest stable release, from the Visual Studio NuGet package manager.<\/p>\n<p>In addition to these time saving enhancements, Xamarin.Forms 3.1 delivers the latest in quality improvements. For a complete rundown of all the little things, <a href=\"https:\/\/developer.xamarin.com\/releases\/xamarin-forms\/xamarin-forms-3.1\/3.1.0\/\">check out the release notes<\/a>.<\/p>\n<p>To quickly explore the updates above, and a few more, check out the demo code below.<\/p>\n<p>Demo: <a href=\"https:\/\/github.com\/davidortinau\/TheLittleThingsPlayground\">https:\/\/github.com\/davidortinau\/TheLittleThingsPlayground<\/a><\/p>\n<p>Want to see what else is coming soon? Follow all the latest information on our GitHub:<\/p>\n<ul>\n<li><a href=\"https:\/\/github.com\/xamarin\/\/wiki\/Feature-Roadmap\">Xamarin.Forms Feature Roadmap<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/xamarin\/\/projects\">Xamarin.Forms Project Boards<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Earlier this year, we surveyed Xamarin.Forms developers about the kinds of custom controls and extra platform code being written repeatedly that should be considered for support \u201cin the box\u201d. From these conversations, we created an initiative to deliver as many as we could in the next several releases. Just six weeks after shipping Xamarin.Forms 3.0 at Build 2018, we are excited to introduce Xamarin.Forms 3.1 with a batch of those enhancements to make your lives easier. Now you can spend more time investing in your applications! In this article, we&#8217;ll take a look at some of the highlights.<\/p>\n","protected":false},"author":553,"featured_media":40987,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[2,367],"tags":[409,1063,16],"class_list":["post-37480","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-developers","category-xamarin-forms","tag-releases","tag-tabs","tag-xamarin-forms"],"acf":[],"blog_post_summary":"<p>Earlier this year, we surveyed Xamarin.Forms developers about the kinds of custom controls and extra platform code being written repeatedly that should be considered for support \u201cin the box\u201d. From these conversations, we created an initiative to deliver as many as we could in the next several releases. Just six weeks after shipping Xamarin.Forms 3.0 at Build 2018, we are excited to introduce Xamarin.Forms 3.1 with a batch of those enhancements to make your lives easier. Now you can spend more time investing in your applications! In this article, we&#8217;ll take a look at some of the highlights.<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/xamarin\/wp-json\/wp\/v2\/posts\/37480","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/xamarin\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/xamarin\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/xamarin\/wp-json\/wp\/v2\/users\/553"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/xamarin\/wp-json\/wp\/v2\/comments?post=37480"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/xamarin\/wp-json\/wp\/v2\/posts\/37480\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/xamarin\/wp-json\/wp\/v2\/media\/40987"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/xamarin\/wp-json\/wp\/v2\/media?parent=37480"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/xamarin\/wp-json\/wp\/v2\/categories?post=37480"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/xamarin\/wp-json\/wp\/v2\/tags?post=37480"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}