{"id":12634,"date":"2020-04-02T09:39:12","date_gmt":"2020-04-02T17:39:12","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/vsnews\/?p=12634"},"modified":"2020-04-02T09:39:12","modified_gmt":"2020-04-02T17:39:12","slug":"aa80emu","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/vsnews\/akams-aa80emu\/","title":{"rendered":"Increase Binding Possibilities with RelativeSource"},"content":{"rendered":"<p><span class=\" author-d-iz88z86z86za0dz67zz78zz78zz74zz68zjz80zz71z9iz90z9pqs3z73zz78zz89zz79zv2z68zz70z2z71zwz73zz87zz70zz88zz70z5tz85zz78zix6z71zjz82z\">The BindingContext is one of the most important parts of the Xamarin.Forms data binding system, especially in MVVM applications. Being built into the Binding type as the common source for bindings in a specific scope reduces plumbing code needed and makes XAML more concise. Unfortunately, for any given View there is only one BindingContext available to bind against.\u00a0<\/span><span class=\"thread-201078709857629268965497 attrcomment attrcommentfirst thread-201078709857629268965497-first author-d-iz88z86z86za0dz67zz78zz78zz74zz68zjz80zz71z9iz90z9pqs3z73zz78zz89zz79zv2z68zz70z2z71zwz73zz87zz70zz88zz70z5tz85zz78zix6z71zjz82z\"><span class=\"comment-extra-inner-span\">Most of the time this isn\u2019t a problem, but complex data hierarchies often lead to situations where an element needs to bind to the BindingContext of some parent element in addition to its own local BindingContext.<\/span><\/span><span class=\" author-d-iz88z86z86za0dz67zz78zz78zz74zz68zjz80zz71z9iz90z9pqs3z73zz78zz89zz79zv2z68zz70z2z71zwz73zz87zz70zz88zz70z5tz85zz78zix6z71zjz82z\">\u00a0For example, you are working with a collection of items using CollectionView. In the DataTemplate of each element you need a Button associated with a Command. However, by default, the BindingContext in the template is an item from the collection. How do we access a Command in the BindingContext of the CollectionView?.<\/span><\/p>\n<div><\/div>\n","protected":false},"excerpt":{"rendered":"<p>The BindingContext is one of the most important parts of the Xamarin.Forms data binding system, especially in MVVM applications. Being built into the Binding type as the common source for bindings in a specific scope reduces plumbing code needed and makes XAML more concise. Unfortunately, for any given View there is only one BindingContext available [&hellip;]<\/p>\n","protected":false},"author":18258,"featured_media":8227,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[3],"tags":[],"class_list":["post-12634","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-allskus"],"acf":[],"blog_post_summary":"<p>The BindingContext is one of the most important parts of the Xamarin.Forms data binding system, especially in MVVM applications. Being built into the Binding type as the common source for bindings in a specific scope reduces plumbing code needed and makes XAML more concise. Unfortunately, for any given View there is only one BindingContext available [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/vsnews\/wp-json\/wp\/v2\/posts\/12634","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/vsnews\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/vsnews\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/vsnews\/wp-json\/wp\/v2\/users\/18258"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/vsnews\/wp-json\/wp\/v2\/comments?post=12634"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/vsnews\/wp-json\/wp\/v2\/posts\/12634\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/vsnews\/wp-json\/wp\/v2\/media\/8227"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/vsnews\/wp-json\/wp\/v2\/media?parent=12634"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/vsnews\/wp-json\/wp\/v2\/categories?post=12634"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/vsnews\/wp-json\/wp\/v2\/tags?post=12634"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}