{"id":46692,"date":"2020-03-25T13:42:30","date_gmt":"2020-03-25T20:42:30","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/xamarin\/?p=46692"},"modified":"2020-04-01T02:34:55","modified_gmt":"2020-04-01T09:34:55","slug":"binding-possibilities-relativesource","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/xamarin\/binding-possibilities-relativesource\/","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. <\/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\"> For 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>\n<h2 data-usually-unique-id=\"287681300701025751687595\"><span class=\" author-d-iz88z86z86za0dz67zz78zz78zz74zz68zjz80zz71z9iz90z9pqs3z73zz78zz89zz79zv2z68zz70z2z71zwz73zz87zz70zz88zz70z5tz85zz78zix6z71zjz82z\">RelativeSource<\/span><\/h2>\n<\/div>\n<div><span class=\"thread-811733132210042433740600 attrcomment thread-839882645444685912116792 attrcommentfirst thread-811733132210042433740600-first author-d-iz88z86z86za0dz67zz78zz78zz74zz68zjz80zz71z9iz90z9pqs3z73zz78zz89zz79zv2z68zz70z2z71zwz73zz87zz70zz88zz70z5tz85zz78zix6z71zjz82z\"><span class=\"comment-extra-inner-span\">The <\/span><\/span><span class=\"thread-811733132210042433740600 attrcomment thread-839882645444685912116792 author-d-iz88z86z86za0dz67zz78zz78zz74zz68zjz80zz71z9iz90z9pqs3z73zz78zz89zz79zv2z68zz70z2z71zwz73zz87zz70zz88zz70z5tz85zz78zix6z71zjz82z\"><span class=\"comment-extra-inner-span\"><b>RelativeSource<\/b><\/span><\/span><span class=\"thread-811733132210042433740600 attrcomment thread-839882645444685912116792 author-d-iz88z86z86za0dz67zz78zz78zz74zz68zjz80zz71z9iz90z9pqs3z73zz78zz89zz79zv2z68zz70z2z71zwz73zz87zz70zz88zz70z5tz85zz78zix6z71zjz82z\"><span class=\"comment-extra-inner-span\"> is a markup extension that is used when we <\/span><\/span><span class=\"thread-811733132210042433740600 attrcomment thread-839882645444685912116792 author-d-iz88z86z86za0dz67zz78zz78zz74zz68zjz80zz71z9iz90z8r2z71zz74zz78zz122z7jqk5k7z72zrez90zz81zz76zz76zlkqz73zz122zz74zyz66zwv\"><span class=\"comment-extra-inner-span\">want <\/span><\/span><span class=\"thread-811733132210042433740600 attrcomment thread-839882645444685912116792 author-d-iz88z86z86za0dz67zz78zz78zz74zz68zjz80zz71z9iz90z9pqs3z73zz78zz89zz79zv2z68zz70z2z71zwz73zz87zz70zz88zz70z5tz85zz78zix6z71zjz82z\"><span class=\"comment-extra-inner-span\">to bind a property of a given element to another property of the element itself, when we <\/span><\/span><span class=\"thread-811733132210042433740600 attrcomment thread-839882645444685912116792 author-d-iz88z86z86za0dz67zz78zz78zz74zz68zjz80zz71z9iz90z8r2z71zz74zz78zz122z7jqk5k7z72zrez90zz81zz76zz76zlkqz73zz122zz74zyz66zwv\"><span class=\"comment-extra-inner-span\">want <\/span><\/span><span class=\"thread-811733132210042433740600 attrcomment thread-839882645444685912116792 author-d-iz88z86z86za0dz67zz78zz78zz74zz68zjz80zz71z9iz90z9pqs3z73zz78zz89zz79zv2z68zz70z2z71zwz73zz87zz70zz88zz70z5tz85zz78zix6z71zjz82z\"><span class=\"comment-extra-inner-span\">to bind a property of a element to another one of its relative parents<\/span><\/span><span class=\"thread-811733132210042433740600 attrcomment thread-839882645444685912116792 author-d-iz88z86z86za0dz67zz78zz78zz74zz68zjz80zz71z9iz90z8r2z71zz74zz78zz122z7jqk5k7z72zrez90zz81zz76zz76zlkqz73zz122zz74zyz66zwv\"><span class=\"comment-extra-inner-span\">,<\/span><\/span><span class=\"thread-811733132210042433740600 attrcomment thread-839882645444685912116792 author-d-iz88z86z86za0dz67zz78zz78zz74zz68zjz80zz71z9iz90z9pqs3z73zz78zz89zz79zv2z68zz70z2z71zwz73zz87zz70zz88zz70z5tz85zz78zix6z71zjz82z\"><span class=\"comment-extra-inner-span\"> and when <\/span><\/span><span class=\"thread-811733132210042433740600 attrcomment thread-839882645444685912116792 author-d-iz88z86z86za0dz67zz78zz78zz74zz68zjz80zz71z9iz90z8r2z71zz74zz78zz122z7jqk5k7z72zrez90zz81zz76zz76zlkqz73zz122zz74zyz66zwv\"><span class=\"comment-extra-inner-span\">we want to bind <\/span><\/span><span class=\"thread-811733132210042433740600 attrcomment thread-839882645444685912116792 author-d-iz88z86z86za0dz67zz78zz78zz74zz68zjz80zz71z9iz90z9pqs3z73zz78zz89zz79zv2z68zz70z2z71zwz73zz87zz70zz88zz70z5tz85zz78zix6z71zjz82z\"><span class=\"comment-extra-inner-span\">a bindable property value to a piece of XAML in custom control development.<\/span><\/span><span class=\"thread-839882645444685912116792 author-d-iz88z86z86za0dz67zz78zz78zz74zz68zjz80zz71z9iz90z9pqs3z73zz78zz89zz79zv2z68zz70z2z71zwz73zz87zz70zz88zz70z5tz85zz78zix6z71zjz82z\"> All of those situations are expressed as relative source modes. RelativeSource has the following modes:<\/span><\/div>\n<div><\/div>\n<ol class=\"listtype-number listindent1 list-number1\" start=\"1\">\n<li><span class=\"thread-367895904132548128271905 attrcomment attrcommentfirst thread-367895904132548128271905-first author-d-iz88z86z86za0dz67zz78zz78zz74zz68zjz80zz71z9iz90z9pqs3z73zz78zz89zz79zv2z68zz70z2z71zwz73zz87zz70zz88zz70z5tz85zz78zix6z71zjz82z\"><span class=\"comment-extra-inner-span\">Self<\/span><\/span><\/li>\n<li><span class=\"thread-367895904132548128271905 attrcomment attrcommentfirst thread-367895904132548128271905-first author-d-iz88z86z86za0dz67zz78zz78zz74zz68zjz80zz71z9iz90z9pqs3z73zz78zz89zz79zv2z68zz70z2z71zwz73zz87zz70zz88zz70z5tz85zz78zix6z71zjz82z\"><span class=\"comment-extra-inner-span\">Find Ancestor<\/span><\/span><\/li>\n<li><span class=\"thread-367895904132548128271905 attrcomment attrcommentfirst thread-367895904132548128271905-first author-d-iz88z86z86za0dz67zz78zz78zz74zz68zjz80zz71z9iz90z9pqs3z73zz78zz89zz79zv2z68zz70z2z71zwz73zz87zz70zz88zz70z5tz85zz78zix6z71zjz82z\"><span class=\"comment-extra-inner-span\">Templated Parent\u00a0<\/span><\/span><\/li>\n<\/ol>\n<div>\n<h3 data-usually-unique-id=\"356100802870560612847064\"><span class=\" author-d-iz88z86z86za0dz67zz78zz78zz74zz68zjz80zz71z9iz90z9pqs3z73zz78zz89zz79zv2z68zz70z2z71zwz73zz87zz70zz88zz70z5tz85zz78zix6z71zjz82z\">1. Self<\/span><\/h3>\n<\/div>\n<div><span class=\" author-d-iz88z86z86za0dz67zz78zz78zz74zz68zjz80zz71z9iz90z9pqs3z73zz78zz89zz79zv2z68zz70z2z71zwz73zz87zz70zz88zz70z5tz85zz78zix6z71zjz82z\">Self indicates the element on which the binding is being set, allowing you to bind one property of that element to another property on the same <\/span><span class=\"thread-281753622859756604499416 attrcomment attrcommentfirst thread-281753622859756604499416-first author-d-iz88z86z86za0dz67zz78zz78zz74zz68zjz80zz71z9iz90z9pqs3z73zz78zz89zz79zv2z68zz70z2z71zwz73zz87zz70zz88zz70z5tz85zz78zix6z71zjz82z\"><span class=\"comment-extra-inner-span\">element<\/span><\/span><span class=\" author-d-iz88z86z86za0dz67zz78zz78zz74zz68zjz80zz71z9iz90z9pqs3z73zz78zz89zz79zv2z68zz70z2z71zwz73zz87zz70zz88zz70z5tz85zz78zix6z71zjz82z\">. For example, we want to draw a square using a BoxView. We can do this using the element name:<\/span><\/div>\n<div>\n<pre class=\"lang:default decode:true\">&lt;BoxView \r\n    x:Name=\"myBoxView\"\r\n    Color=\"Red\"  \r\n    HeightRequest=\"100\"\r\n    WidthRequest=\"{Binding Source={x:Reference myBoxView}, Path=HeightRequest}}\" \/&gt;<\/pre>\n<\/div>\n<div><span class=\" author-d-iz88z86z86za0dz67zz78zz78zz74zz68zjz80zz71z9iz90z8r2z71zz74zz78zz122z7jqk5k7z72zrez90zz81zz76zz76zlkqz73zz122zz74zyz66zwv\">Alternatively<\/span><span class=\" author-d-iz88z86z86za0dz67zz78zz78zz74zz68zjz80zz71z9iz90z9pqs3z73zz78zz89zz79zv2z68zz70z2z71zwz73zz87zz70zz88zz70z5tz85zz78zix6z71zjz82z\">, we can <\/span><span class=\" author-d-iz88z86z86za0dz67zz78zz78zz74zz68zjz80zz71z9iz90z8r2z71zz74zz78zz122z7jqk5k7z72zrez90zz81zz76zz76zlkqz73zz122zz74zyz66zwv\">achieve the same result<\/span><span class=\" author-d-iz88z86z86za0dz67zz78zz78zz74zz68zjz80zz71z9iz90z9pqs3z73zz78zz89zz79zv2z68zz70z2z71zwz73zz87zz70zz88zz70z5tz85zz78zix6z71zjz82z\"> using the RelativeSource:<\/span><\/div>\n<div>\n<pre class=\"lang:default decode:true  \">&lt;BoxView \r\n    Color=\"Red\"\r\n    HeightRequest=\"100\"\r\n    Width=\"{Binding Source={RelativeSource Self}, Path=HeightRequest}\"\/&gt;<\/pre>\n<div>\n<p><img decoding=\"async\" class=\"aligncenter wp-image-46698 size-large\" src=\"https:\/\/devblogs.microsoft.com\/xamarin\/wp-content\/uploads\/sites\/44\/2020\/03\/relativesource-self-1024x671.png\" alt=\"Using FindAncestor relative source\" width=\"640\" height=\"419\" srcset=\"https:\/\/devblogs.microsoft.com\/xamarin\/wp-content\/uploads\/sites\/44\/2020\/03\/relativesource-self-1024x671.png 1024w, https:\/\/devblogs.microsoft.com\/xamarin\/wp-content\/uploads\/sites\/44\/2020\/03\/relativesource-self-300x196.png 300w, https:\/\/devblogs.microsoft.com\/xamarin\/wp-content\/uploads\/sites\/44\/2020\/03\/relativesource-self-768x503.png 768w, https:\/\/devblogs.microsoft.com\/xamarin\/wp-content\/uploads\/sites\/44\/2020\/03\/relativesource-self.png 1249w\" sizes=\"(max-width: 640px) 100vw, 640px\" \/><\/p>\n<h3 data-usually-unique-id=\"311422072833927122789570\"><span class=\"thread-706005426456585195753961 attrcomment attrcommentfirst thread-706005426456585195753961-first author-d-iz88z86z86za0dz67zz78zz78zz74zz68zjz80zz71z9iz90z9pqs3z73zz78zz89zz79zv2z68zz70z2z71zwz73zz87zz70zz88zz70z5tz85zz78zix6z71zjz82z\"><span class=\"comment-extra-inner-span\">2. Find Ancestor<\/span><\/span><\/h3>\n<\/div>\n<div><span class=\" author-d-iz88z86z86za0dz67zz78zz78zz74zz68zjz80zz71z9iz90z9pqs3z73zz78zz89zz79zv2z68zz70z2z71zwz73zz87zz70zz88zz70z5tz85zz78zix6z71zjz82z\">The FindAncestor relative binding modes are used to bind to parent elements in the visual tree.\u00a0<\/span><\/div>\n<div>\n<pre class=\"lang:default decode:true \">&lt;CollectionView\r\n    ItemsSource=\"{Binding Drinks}\"&gt;\r\n    &lt;CollectionView.ItemTemplate&gt;\r\n        &lt;DataTemplate&gt;\r\n            &lt;Grid&gt;\r\n            ...  \r\n            &lt;Button\r\n                Command=\"{Binding Source={RelativeSource AncestorType={x:Type viewmodels:RelativeSourceViewModel}}, Path=BuyCommand}\"\r\n                CommandParameter=\"{Binding Source={RelativeSource Self}, Path=BindingContext}\"\r\n                ... \/&gt;\r\n            &lt;\/Grid&gt;\r\n        &lt;\/DataTemplate&gt;\r\n    &lt;\/CollectionView.ItemTemplate&gt;\r\n&lt;\/CollectionView&gt;<\/pre>\n<p><span style=\"font-size: 1rem;\">In this example, the BindingContext of the page is set to the RelativeSourceViewModel property of itself. The CollectionView binds to the Drinks property of the viewmodel. The DataTemplate, which defines the appearance of each item in the CollectionView, contains a Button. The button&#8217;s Command property is bound to the BuyCommand in its parent&#8217;s viewmodel.\u00a0<\/span><\/p>\n<\/div>\n<div>\n<div><span class=\" author-d-iz88z86z86za0dz67zz78zz78zz74zz68zjz80zz71z9iz90z9pqs3z73zz78zz89zz79zv2z68zz70z2z71zwz73zz87zz70zz88zz70z5tz85zz78zix6z71zjz82z\">The <\/span><span class=\" author-d-iz88z86z86za0dz67zz78zz78zz74zz68zjz80zz71z9iz90z9pqs3z73zz78zz89zz79zv2z68zz70z2z71zwz73zz87zz70zz88zz70z5tz85zz78zix6z71zjz82z\"><b>AncestorType<\/b><\/span><span class=\" author-d-iz88z86z86za0dz67zz78zz78zz74zz68zjz80zz71z9iz90z9pqs3z73zz78zz89zz79zv2z68zz70z2z71zwz73zz87zz70zz88zz70z5tz85zz78zix6z71zjz82z\"> property should be set to the type of the element to use as the source.<\/span><\/div>\n<\/div>\n<\/div>\n<div>\n<p><img decoding=\"async\" class=\"aligncenter wp-image-46701 size-large\" src=\"https:\/\/devblogs.microsoft.com\/xamarin\/wp-content\/uploads\/sites\/44\/2020\/03\/relativesource-findancestor-1024x671.png\" alt=\"Using FindAncestor relative source\" width=\"640\" height=\"419\" srcset=\"https:\/\/devblogs.microsoft.com\/xamarin\/wp-content\/uploads\/sites\/44\/2020\/03\/relativesource-findancestor-1024x671.png 1024w, https:\/\/devblogs.microsoft.com\/xamarin\/wp-content\/uploads\/sites\/44\/2020\/03\/relativesource-findancestor-300x196.png 300w, https:\/\/devblogs.microsoft.com\/xamarin\/wp-content\/uploads\/sites\/44\/2020\/03\/relativesource-findancestor-768x503.png 768w, https:\/\/devblogs.microsoft.com\/xamarin\/wp-content\/uploads\/sites\/44\/2020\/03\/relativesource-findancestor.png 1249w\" sizes=\"(max-width: 640px) 100vw, 640px\" \/><\/p>\n<div>\n<h3 data-usually-unique-id=\"852357491858401776126384\"><span class=\" author-d-iz88z86z86za0dz67zz78zz78zz74zz68zjz80zz71z9iz90z9pqs3z73zz78zz89zz79zv2z68zz70z2z71zwz73zz87zz70zz88zz70z5tz85zz78zix6z71zjz82z\">3. Templated Parent<\/span><\/h3>\n<\/div>\n<div><span class=\" author-d-iz88z86z86za0dz67zz78zz78zz74zz68zjz80zz71z9iz90z9pqs3z73zz78zz89zz79zv2z68zz70z2z71zwz73zz87zz70zz88zz70z5tz85zz78zix6z71zjz82z\">This mode enables<\/span><span class=\" author-d-iz88z86z86za0dz67zz78zz78zz74zz68zjz80zz71z9iz90z8r2z71zz74zz78zz122z7jqk5k7z72zrez90zz81zz76zz76zlkqz73zz122zz74zyz66zwv\"> you to<\/span><span class=\" author-d-iz88z86z86za0dz67zz78zz78zz74zz68zjz80zz71z9iz90z9pqs3z73zz78zz89zz79zv2z68zz70z2z71zwz73zz87zz70zz88zz70z5tz85zz78zix6z71zjz82z\"> tie a given ControlTemplate property to a property of the control that the ControlTemplate is applied to. \u00a0<\/span><\/div>\n<div><span class=\" author-d-iz88z86z86za0dz67zz78zz78zz74zz68zjz80zz71z9iz90z9pqs3z73zz78zz89zz79zv2z68zz70z2z71zwz73zz87zz70zz88zz70z5tz85zz78zix6z71zjz82z\">To <\/span><span class=\" author-d-iz88z86z86za0dz67zz78zz78zz74zz68zjz80zz71z9iz90z8r2z71zz74zz78zz122z7jqk5k7z72zrez90zz81zz76zz76zlkqz73zz122zz74zyz66zwv\">better <\/span><span class=\" author-d-iz88z86z86za0dz67zz78zz78zz74zz68zjz80zz71z9iz90z9pqs3z73zz78zz89zz79zv2z68zz70z2z71zwz73zz87zz70zz88zz70z5tz85zz78zix6z71zjz82z\">understand this mode, let\u2019s see an example:<\/span><\/div>\n<\/div>\n<div>\n<pre class=\"lang:default decode:true \">&lt;ControlTemplate x:Key=\"DrinkCardViewControlTemplate\"&gt;\r\n    &lt;Grid&gt;\r\n        &lt;Frame\r\n            BindingContext=\"{Binding Source={RelativeSource TemplatedParent}}\"&gt;\r\n            &lt;StackLayout&gt;\r\n                &lt;Label \r\n                    Text=\"{Binding DrinkTitle}\"\r\n                    ... \/&gt;\r\n                ...\r\n            &lt;\/Grid&gt;\r\n        &lt;\/Frame&gt;\r\n    &lt;\/Grid&gt;\r\n&lt;\/ControlTemplate&gt;<\/pre>\n<p><span class=\" author-d-iz88z86z86za0dz67zz78zz78zz74zz68zjz80zz71z9iz90z9pqs3z73zz78zz89zz79zv2z68zz70z2z71zwz73zz87zz70zz88zz70z5tz85zz78zix6z71zjz82z\">In this example, the Frame, which is the root element of the ControlTemplate, has its BindingContext set to the runtime object instance to which the template is applied. Therefore, the Frame and its children resolve their binding expressions against the properties of each custom control object.<\/span><\/p>\n<pre class=\"lang:default decode:true \">&lt;controls:DrinkCardView\r\n     DrinkTitle=\"BRAZILIAN COFFEE\"\r\n     DrinkDescription=\"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.\"\r\n     DrinkColor=\"Maroon\"\r\n     DrinkImageSource=\"coffee.png\"\r\n     ControlTemplate=\"{StaticResource DrinkCardViewControlTemplate}\" \/&gt;<\/pre>\n<div>\n<p data-usually-unique-id=\"187476041902762989395064\"><img decoding=\"async\" class=\"aligncenter size-large wp-image-46703\" src=\"https:\/\/devblogs.microsoft.com\/xamarin\/wp-content\/uploads\/sites\/44\/2020\/03\/relativesource-templatedparent-1024x671.png\" alt=\"Using TemplatedParent relative source\" width=\"640\" height=\"419\" srcset=\"https:\/\/devblogs.microsoft.com\/xamarin\/wp-content\/uploads\/sites\/44\/2020\/03\/relativesource-templatedparent-1024x671.png 1024w, https:\/\/devblogs.microsoft.com\/xamarin\/wp-content\/uploads\/sites\/44\/2020\/03\/relativesource-templatedparent-300x196.png 300w, https:\/\/devblogs.microsoft.com\/xamarin\/wp-content\/uploads\/sites\/44\/2020\/03\/relativesource-templatedparent-768x503.png 768w, https:\/\/devblogs.microsoft.com\/xamarin\/wp-content\/uploads\/sites\/44\/2020\/03\/relativesource-templatedparent.png 1249w\" sizes=\"(max-width: 640px) 100vw, 640px\" \/><\/p>\n<h2 data-usually-unique-id=\"187476041902762989395064\"><span class=\"thread-604447921595083196794431 attrcomment attrcommentfirst thread-604447921595083196794431-first author-d-iz88z86z86za0dz67zz78zz78zz74zz68zjz80zz71z9iz90z9pqs3z73zz78zz89zz79zv2z68zz70z2z71zwz73zz87zz70zz88zz70z5tz85zz78zix6z71zjz82z\"><span class=\"comment-extra-inner-span\">Learn More<\/span><\/span><\/h2>\n<\/div>\n<div><span class=\" author-d-iz88z86z86za0dz67zz78zz78zz74zz68zjz80zz71z9iz90z9pqs3z73zz78zz89zz79zv2z68zz70z2z71zwz73zz87zz70zz88zz70z5tz85zz78zix6z71zjz82z\">Hopefully this blog was helpful and showed you how easy it is to use RelativeSource. You can find the <\/span><span class=\"attrlink url author-d-iz88z86z86za0dz67zz78zz78zz74zz68zjz80zz71z9iz90z9pqs3z73zz78zz89zz79zv2z68zz70z2z71zwz73zz87zz70zz88zz70z5tz85zz78zix6z71zjz82z\"><a class=\"attrlink\" href=\"https:\/\/github.com\/jsuarezruiz\/RelativeSourcePlayground\" target=\"_blank\" rel=\"noreferrer nofollow noopener\" data-target-href=\"https:\/\/github.com\/jsuarezruiz\/RelativeSourcePlayground\">sample<\/a><\/span><span class=\" author-d-iz88z86z86za0dz67zz78zz78zz74zz68zjz80zz71z9iz90z9pqs3z73zz78zz89zz79zv2z68zz70z2z71zwz73zz87zz70zz88zz70z5tz85zz78zix6z71zjz82z\"> we have seen in this article and read more about RelativeSource in our <\/span><span class=\"attrlink url author-d-iz88z86z86za0dz67zz78zz78zz74zz68zjz80zz71z9iz90z9pqs3z73zz78zz89zz79zv2z68zz70z2z71zwz73zz87zz70zz88zz70z5tz85zz78zix6z71zjz82z\"><a class=\"attrlink\" href=\"https:\/\/docs.microsoft.com\/en-us\/xamarin\/xamarin-forms\/app-fundamentals\/data-binding\/relative-bindings\" target=\"_blank\" rel=\"noreferrer nofollow noopener\" data-target-href=\"https:\/\/docs.microsoft.com\/es-es\/xamarin\/xamarin-forms\/app-fundamentals\/data-binding\/relative-bindings\"><u>amazing documentation<\/u><\/a><\/span><span class=\" author-d-iz88z86z86za0dz67zz78zz78zz74zz68zjz80zz71z9iz90z9pqs3z73zz78zz89zz79zv2z68zz70z2z71zwz73zz87zz70zz88zz70z5tz85zz78zix6z71zjz82z\">.<\/span><\/div>\n<\/div>\n<div><\/div>\n","protected":false},"excerpt":{"rendered":"<p>RelativeSource is a markup extension that is used to bind a property of a given element to another property of the element itself. This articles shares examples, documentation, and more!<\/p>\n","protected":false},"author":20406,"featured_media":39167,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[367],"tags":[607,8202],"class_list":["post-46692","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-xamarin-forms","tag-binding","tag-relativesource"],"acf":[],"blog_post_summary":"<p>RelativeSource is a markup extension that is used to bind a property of a given element to another property of the element itself. This articles shares examples, documentation, and more!<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/xamarin\/wp-json\/wp\/v2\/posts\/46692","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\/20406"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/xamarin\/wp-json\/wp\/v2\/comments?post=46692"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/xamarin\/wp-json\/wp\/v2\/posts\/46692\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/xamarin\/wp-json\/wp\/v2\/media\/39167"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/xamarin\/wp-json\/wp\/v2\/media?parent=46692"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/xamarin\/wp-json\/wp\/v2\/categories?post=46692"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/xamarin\/wp-json\/wp\/v2\/tags?post=46692"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}