I was very excited to read that Xamarin would finally have Relative Binding.
- https://docs.microsoft.com/en-us/xamarin/xamarin-forms/app-fundamentals/data-binding/relative-bindings?source=docs
- https://www.davidbritch.com/2019/11/bind-from-controltemplate-to-viewmodel.html#comment-form
However its seems to be just plain unrecognized to my IDE.
Visual Studio 2019, latest as of 15nov2019
Xamarin.Forms 4.3.xx, latest as of 15nov2019
New-ish basic app from current templates, that I use for testing such things.
I try the markup as described both in the docs and the blog... Nope. Unrecognized and doesn't bind to the property.
<ContentView
x:Class="MCRUX.Controls.ButtonFramed"
xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:d="http://xamarin.com/schemas/2014/forms/design"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
x:Name="thisButton"
mc:Ignorable="d"
BindingContext="{Binding Source={RelativeSource Self}, Path=DefaultViewModel}">
{...}
Has anyone else made it work? Is there a tip/trick in the documentation I'm just missing? Does it require an experimental SetFlags
like CollectionView_Experimental
and Shell_Experimental
required?