I read in the documentation that the following example should work in a Xamarin project.
<Label Text="{Binding Name}"
HeightRequest="30"
WidthRequest="{Binding Source={RelativeSource Self}, Path=HeightRequest}">
</Label>
But my visual studio (up to date v2019) marks the 'RelativeSource Self' part in red and gives me the following compile errors:
- Error XLS0414 The type 'RelativeSource' was not found. Verify that you are not missing an assembly reference and that all referenced assemblies have been built.
- Error Position 20:79. Type RelativeSource not found in xmlns http://xamarin.com/schemas/2014/forms
Weirdly enough, when opening the sample project found here, visual studio also shows 'RelativeSource Self' in red but does compile.
I have not read anywhere that I need to include an assembly for this and VisualStudio and resharper don't give me include hints.
OK.. UPDATE .. I found out that I needed to upgrade my xamarin.forms references from 4.1 to 4.4 to get rid of the compile warnings.
But I find it odd that VisualStudio keeps marking the statement 'RelativeSource Self' in red.