[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 :)

Comments

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

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

      Delete
  2. Thanks for this. This helped me to figure out my bug as well.

    ReplyDelete
  3. I got the same error and I saw this. It worked! thanks a lot! :P

    ReplyDelete
  4. You just saved me a bunch of time. I don't know how to thank you!

    ReplyDelete

Post a Comment

Popular posts from this blog

EMGU with Xamarin Forms guide [part 1]

Xamarin Forms essential: FFImageLoading, manage your images

[SocialCut] released! Make instagram grids, panorama and more