{"id":6688,"date":"2019-01-03T21:18:08","date_gmt":"2019-01-03T21:18:08","guid":{"rendered":"http:\/\/putridparrot.com\/blog\/?p=6688"},"modified":"2019-01-03T21:18:08","modified_gmt":"2019-01-03T21:18:08","slug":"added-a-clicking-command-to-labels-and-more","status":"publish","type":"post","link":"https:\/\/putridparrot.com\/blog\/added-a-clicking-command-to-labels-and-more\/","title":{"rendered":"Added a clicking command to Labels (and more)"},"content":{"rendered":"<p>I wanted to have a clickable label in my Xamarin Forms application. A button was just a little too large for my requirements, but a standard Label does not have a click command. However, it&#8217;s easy to create such an command handler, this also works for other UI elements.<\/p>\n<p>In your XAML just use the GestureRecognizers collection and add a TapGestureRecongizer, like this<\/p>\n<pre class=\"brush: xml; title: ; notranslate\" title=\"\">\r\n&lt;Label Text=&quot;More...&quot;&gt;\r\n   &lt;Label.GestureRecognizers&gt;\r\n      &lt;TapGestureRecognizer Command=&quot;{Binding MoreCommand}&quot; \/&gt;\r\n   &lt;\/Label.GestureRecognizers&gt;\r\n&lt;\/Label&gt;\r\n<\/pre>\n<p>Simple.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I wanted to have a clickable label in my Xamarin Forms application. A button was just a little too large for my requirements, but a standard Label does not have a click command. However, it&#8217;s easy to create such an command handler, this also works for other UI elements. In your XAML just use the [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[122],"tags":[],"class_list":["post-6688","post","type-post","status-publish","format-standard","hentry","category-xamarin-forms"],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/posts\/6688","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/comments?post=6688"}],"version-history":[{"count":2,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/posts\/6688\/revisions"}],"predecessor-version":[{"id":6690,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/posts\/6688\/revisions\/6690"}],"wp:attachment":[{"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/media?parent=6688"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/categories?post=6688"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/tags?post=6688"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}