{"id":44391,"date":"2019-06-05T12:34:55","date_gmt":"2019-06-05T19:34:55","guid":{"rendered":"http:\/\/devblogs.microsoft.com\/xamarin\/?p=44391"},"modified":"2019-08-30T08:28:58","modified_gmt":"2019-08-30T15:28:58","slug":"checkbox-xamarin-forms-4-1-0-pre-release","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/xamarin\/checkbox-xamarin-forms-4-1-0-pre-release\/","title":{"rendered":"CheckBox with Xamarin.Forms 4.1.0 Pre-Release"},"content":{"rendered":"<p>Just a few weeks ago we <a href=\"https:\/\/devblogs.microsoft.com\/xamarin\/introducing-xamarin-forms-4-0-the-era-of-shell\/\" target=\"_blank\" rel=\"noopener noreferrer\">shipped Xamarin.Forms 4.0<\/a>, which introduced the <a href=\"https:\/\/devblogs.microsoft.com\/xamarin\/shell-xamarin-forms-4-0-getting-started\/\" target=\"_blank\" rel=\"noopener noreferrer\">new Shell navigation<\/a> for quickly bootstrapping your applications. As well as image source unification to make it convenient to use the same images everywhere, like the new FontImageSource. Several months ago our very own James Montemagno submitted a pull request introducing a CheckBox control. In recent days we also shipped a service release to quickly respond to the feedback you sent us. You&#8217;re not slowing down, and neither are we!<\/p>\n<p>Today we are shipping a pre-release of our next version, Xamarin.Forms 4.1. Here&#8217;s is what is in store for you.<\/p>\n<h2 id=\"checkbox-has-arrived\">CheckBox has Arrived<\/h2>\n<p>Our team worked with James to get CheckBox across the line, and we&#8217;re excited to now share it with you. We have also provided Material versions of <code>CheckBox<\/code> when you use Visual.<\/p>\n<pre class=\"\">&lt;CheckBox IsChecked=\"True\" Color=\"Blue\" \/&gt;<\/pre>\n<h4>Android<\/h4>\n<p><img decoding=\"async\" class=\"wp-image-44408 alignnone\" src=\"http:\/\/devblogs.microsoft.com\/xamarin\/wp-content\/uploads\/sites\/44\/2019\/06\/android-checkbox.gif\" alt=\"\" width=\"399\" height=\"130\" \/><\/p>\n<h4><\/h4>\n<h4>iOS<\/h4>\n<p><img decoding=\"async\" class=\"wp-image-44415 size-full alignnone\" src=\"http:\/\/devblogs.microsoft.com\/xamarin\/wp-content\/uploads\/sites\/44\/2019\/06\/ios-checkbox.gif\" alt=\"\" width=\"394\" height=\"137\" \/><\/p>\n<h4>UWP<\/h4>\n<p><img decoding=\"async\" class=\"size-full wp-image-44418 alignnone\" src=\"http:\/\/devblogs.microsoft.com\/xamarin\/wp-content\/uploads\/sites\/44\/2019\/06\/uwp-checkbox.png\" alt=\"\" width=\"313\" height=\"129\" srcset=\"https:\/\/devblogs.microsoft.com\/xamarin\/wp-content\/uploads\/sites\/44\/2019\/06\/uwp-checkbox.png 313w, https:\/\/devblogs.microsoft.com\/xamarin\/wp-content\/uploads\/sites\/44\/2019\/06\/uwp-checkbox-300x124.png 300w\" sizes=\"(max-width: 313px) 100vw, 313px\" \/><\/p>\n<p>CheckBox is implemented for many platforms:<\/p>\n<ul>\n<li>iOS<\/li>\n<li>Android<\/li>\n<li>UWP<\/li>\n<li>MacOS<\/li>\n<li>WPF<\/li>\n<\/ul>\n<p>This control marks another significant step in the transition of Xamarin.Forms from being platform focused, to being customer focused. Previously, if a control did not exist on all of the primary Xamarin.Forms platforms of Android, iOS, and UWP then it was considered platform specific and would not be implemented. Today, however, when we hear that you need a cross-platform control that isn&#8217;t present on 1 of the 3 platforms, we will consider how we can meet that need for you.<\/p>\n<h2 id=\"improved-text-scaling-for-ios-accessibility\">Improved Text Scaling for iOS Accessibility<\/h2>\n<p><img decoding=\"async\" class=\"alignleft wp-image-44425\" src=\"http:\/\/devblogs.microsoft.com\/xamarin\/wp-content\/uploads\/sites\/44\/2019\/06\/fontsize-accessibility.gif\" alt=\"\" width=\"171\" height=\"305\" \/><\/p>\n<p>We now use the iOS preferred font scaling features, so your fonts will magically size in response to the user&#8217;s accessibility preferences when you used named font sizes. And there are more sizes to now choose from:<\/p>\n<ul>\n<li>Large = 4,<\/li>\n<li>Body = 5,<\/li>\n<li>Header = 6,<\/li>\n<li>Title = 7,<\/li>\n<li>Subtitle = 8,<\/li>\n<li>Caption = 9<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<div style=\"clear: both;\"\/>\n<p>&nbsp;<\/p>\n<h2 id=\"developers-love-maps\">Developers Love Maps<\/h2>\n<p>One of the great benefits of writing native cross-platform apps is having the native maps at your fingertips. Frequent contributor, Andrei Nitescu, has once again sent a flurry of very useful enhancements, this time for maps.<\/p>\n<h3 id=\"itemtemplateselector\">ItemTemplateSelector<\/h3>\n<p>In version 3.6, Andrei added <code>ItemsSource<\/code> to Maps so you could generate pins on your map based on bindings. Now, in version 4.1, you can also use a template selector to display different templates according to your need.<\/p>\n<pre class=\"lang:xhtml decode:true \">&lt;ContentPage.Resources&gt;\r\n    &lt;ResourceDictionary&gt;\r\n        &lt;local:MapItemTemplateSelector x:Key=\"MapItemTemplateSelector\"&gt;\r\n            &lt;local:MapItemTemplateSelector.DataTemplate&gt;\r\n                &lt;DataTemplate&gt;\r\n                    &lt;map:Pin Position=\"{Binding Position}\"\r\n                                Address=\"{Binding Address}\"\r\n                                Label=\"{Binding Description}\" \/&gt;\r\n                &lt;\/DataTemplate&gt;\r\n            &lt;\/local:MapItemTemplateSelector.DataTemplate&gt;\r\n        &lt;\/local:MapItemTemplateSelector&gt;\r\n    &lt;\/ResourceDictionary&gt;\r\n&lt;\/ContentPage.Resources&gt;\r\n\r\n&lt;map:Map \r\n    ItemsSource=\"{Binding Places}\"\r\n    ItemTemplateSelector=\"{StaticResource MapItemTemplateSelector}\" \/&gt;<\/pre>\n<pre class=\"lang:c# decode:true \">class MapItemTemplateSelector : DataTemplateSelector\r\n{\r\n    public DataTemplate DataTemplate { get; set; }\r\n\r\n    protected override DataTemplate OnSelectTemplate(object item, BindableObject container)\r\n    {\r\n        return DataTemplate;\r\n    }\r\n}<\/pre>\n<h3><\/h3>\n<h3 id=\"where-did-you-click\">Where Did You Click?<\/h3>\n<p>This seems like a fundamental thing you might want to know, and it looks like <a href=\"https:\/\/github.com\/xamarin\/Xamarin.Forms\/pull\/5317\" target=\"_blank\" rel=\"noopener noreferrer\">Joe Manke thought so too<\/a>. With Joe&#8217;s <a href=\"https:\/\/github.com\/xamarin\/Xamarin.Forms\/pull\/5317\" target=\"_blank\" rel=\"noopener noreferrer\">contribution<\/a>, you can get that information by subscribing to the <code>MapClicked<\/code> event on your map. You will then get back coordinates indicating where the user touched down.<\/p>\n<pre class=\"\">&lt;map:Map MapClicked=\"Handle_MapClicked\" \/&gt;\r\n<\/pre>\n<pre class=\"lang:c# decode:true\">void Handle_MapClicked(object sender, MapClickedEventArgs e)\r\n{\r\n    Debug.WriteLine($\"Last MapClick: {e.Position.Latitude}, {e.Position.Longitude}\");\r\n}<\/pre>\n<h2 id=\"locating-children-in-control-templates\">Locating Children in Control Templates<\/h2>\n<p>Sometimes it&#8217;s really helpful to get a reference to a control within a control template. Once again, it&#8217;s Andrei Nitescu to the rescue! His <a href=\"https:\/\/github.com\/xamarin\/Xamarin.Forms\/pull\/5691\" target=\"_blank\" rel=\"noopener noreferrer\">contribution<\/a> allow you to do just that with a new method:<code>GetTemplateChild<\/code> and a convenient new lifecycle method:\u00a0<code>OnApplyTemplate<\/code>.<\/p>\n<pre class=\"lang:xhtml decode:true\">&lt;controls:MyCustomControl... &gt;\r\n    &lt;controls:MyCustomControl.ControlTemplate&gt;\r\n         &lt;ControlTemplate&gt;\r\n              &lt;Label x:Name=\"myLabel\"\/&gt;\r\n         &lt;\/ControlTemplate&gt;\r\n    &lt;controls:MyCustomControl.ControlTemplate&gt;\r\n&lt;\/controls:MyCustomControl&gt;<\/pre>\n<pre class=\"lang:default decode:true\">class MyCustomControl : TemplatedView\r\n{\r\n      Label _myLabel;\r\n\r\n       protected override OnApplyTemplate()\r\n       {  \r\n               _myLabel = GetTemplateChild(\"myLabel\");\r\n       }\r\n}<\/pre>\n<h2 id=\"all-the-platforms-get-love\">All the Platforms Get Love<\/h2>\n<p>While our core efforts continue to show up first and foremost on Android and iOS, there is no lack of activity among the other platforms, starting with Tizen. Samsung has been busy keeping up with us by adding support for Shell, Visual, Material renderers, named font sizes, and CollectionView among other things.<\/p>\n<p>UWP, macOS, WPF, and GTK all made forward progress in this release. Thank you to all the amazing contributors.<\/p>\n<p>&nbsp;<\/p>\n<p><div style=\"width: 358px;\" class=\"wp-video\"><video class=\"wp-video-shortcode\" id=\"video-44391-1\" width=\"358\" height=\"638\" preload=\"auto\" controls=\"controls\"><source type=\"video\/mp4\" src=\"http:\/\/devblogs.microsoft.com\/xamarin\/wp-content\/uploads\/sites\/44\/2019\/06\/Visual.mp4?_=1\" \/><a href=\"http:\/\/devblogs.microsoft.com\/xamarin\/wp-content\/uploads\/sites\/44\/2019\/06\/Visual.mp4\">http:\/\/devblogs.microsoft.com\/xamarin\/wp-content\/uploads\/sites\/44\/2019\/06\/Visual.mp4<\/a><\/video><\/div><\/p>\n<p>&nbsp;<\/p>\n<h2 id=\"update-today\">Update Today<\/h2>\n<p>Xamarin.Forms 4.1-pre1 is ready for you to go hands-on. So open up your favorite NuGet manager and update a project with CheckBox today. If you discover something wrong, please let us know immediately by <a href=\"https:\/\/github.com\/xamarin\/Xamarin.Forms\/issues\/new\/choose\">filing a helpful report on GitHub<\/a>.<\/p>\n<p>For a detailed look at everything included, check out the <a href=\"https:\/\/docs.microsoft.com\/en-us\/xamarin\/xamarin-forms\/release-notes\/4.1\/4.1.0-pre1\" target=\"_blank\" rel=\"noopener noreferrer\">release notes<\/a>. And a special <a href=\"https:\/\/docs.microsoft.com\/en-us\/xamarin\/xamarin-forms\/release-notes\/4.1\/4.1.0-pre1#thank-you\" target=\"_blank\" rel=\"noopener noreferrer\">thank you to all who contributed<\/a> to this release. Your contributions are now immortalized in the release notes.<\/p>\n<p>Not ready to take the leap yourself? Head over to my <a href=\"https:\/\/twitch.tv\/davidortinau\">Twitch channel<\/a> to watch how I upgrade the Xappy project and work on implementing these new updates to give you an idea how it all works and why you should be excited about the latest release.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Xamarin.Forms 4.0 introduced the new Shell navigation and image source unification. Today, we are shipping a pre-release of our next version, Xamarin.Forms 4.1 which introduces a CheckBox control. <\/p>\n","protected":false},"author":553,"featured_media":44409,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[5216,2,367],"tags":[],"class_list":["post-44391","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-announcements","category-developers","category-xamarin-forms"],"acf":[],"blog_post_summary":"<p>Xamarin.Forms 4.0 introduced the new Shell navigation and image source unification. Today, we are shipping a pre-release of our next version, Xamarin.Forms 4.1 which introduces a CheckBox control. <\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/xamarin\/wp-json\/wp\/v2\/posts\/44391","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=44391"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/xamarin\/wp-json\/wp\/v2\/posts\/44391\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/xamarin\/wp-json\/wp\/v2\/media\/44409"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/xamarin\/wp-json\/wp\/v2\/media?parent=44391"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/xamarin\/wp-json\/wp\/v2\/categories?post=44391"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/xamarin\/wp-json\/wp\/v2\/tags?post=44391"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}