xamarin / Xamarin.Forms

Xamarin.Forms is no longer supported. Migrate your apps to .NET MAUI.
https://aka.ms/xamarin-upgrade
Other
5.62k stars 1.87k forks source link

Xamarin Forms 4.3 "RelativeSource" and related markup seen as errors in XML editor #8679

Open vsfeedback opened 4 years ago

vsfeedback commented 4 years ago

This issue has been moved from a ticket on Developer Community.


<?xml version="1.0" encoding="UTF-8" ?>
<ContentView
    x:Class="My.Cool.Custom.Control"
    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}}">
...

RelativeSource and related markup such as AncestorType and all the other new markup with Xamarin Forms 4.3 report as unrecognized and show as red/bad in the XAML editor for VS2019

MSDN page for new feature https://docs.microsoft.com/en-us/xamarin/xamarin-forms/app-fundamentals/data-binding/relative-bindings?source=docs

Sample project is easy enough... Just download the Microsoft sample. https://docs.microsoft.com/en-us/samples/xamarin/xamarin-forms-samples/databindingdemos/


Original Comments

Visual Studio Feedback System on 11/17/2019, 10:37 PM:

We have directed your feedback to the appropriate engineering team for further evaluation. The team will review the feedback and notify you about the next steps.


Original Solutions

(no solutions)

StephaneDelcroix commented 4 years ago

/cc @mgoertz-msft

chrisg32 commented 4 years ago

I was experiencing what I believe to be the same problem, however, in my case, I am using JetBrains ReSharper and this seems to be a problem with ReSharper's Intellisense, not VisualStudio's.

I am not sure if that helps resolves this bug but I figured I would share.

With ReSharper Enabled

image

With ReSharper Disabled

image

Additional context arround original bug

Perhaps I can provide more context. Xamarin Forms 4.3 added relative binding support, documented here: https://docs.microsoft.com/en-us/xamarin/xamarin-forms/app-fundamentals/data-binding/relative-bindings.

For an example you can look at the data binding on this page of the xamarin-forms-samples project.

chrisg32 commented 4 years ago

There is already an issue for ReSharper for those who are interested: https://youtrack.jetbrains.com/issue/RSRP-476816