[Xamarin Forms] build error: Unable to cast object of type 'Xamarin.Forms.Xaml.ElementNode' to type 'Xamarin.Forms.Xaml.ValueNode'

Xaml build error

For one of my Xamarin project, I just had this build error:
This error was related to my XAML code:

Unable to cast object of type 'Xamarin.Forms.Xaml.ElementNode' to type 'Xamarin.Forms.Xaml.ValueNode'

After searching for a long 'moment', I just didn't understand what happened...

My investigation (this process can help you :p)

So I decided to remove a large part of my xaml code and then re-add it little by little. Each step I tried to compile to see when error occurs.

So In my case, I determined that the piece of code that was going wrong was the following:

Ok, it was my mistake but in the code editor, Visual Studio didn't tell me anything.
I was trying to bind an event (I though it was a property) to a DateTime property... What is not possible.

Hope this helps someone to save a few minutes :)


Some say he’s half man half fish, others say he’s more of a seventy/thirty split. Either way he’s a fishy bastard.

2 commentaires:

  1. This did help me with a similar error with a ListView. I was binding to ItemSelected instead of SelectedItem.
    Thanks for this!

    1. Glad it helped you ! I hope you didn't lose to much time with this :p