Programming, Xamarin

[SOLVED] Unable to cast object of type ‘Xamarin. Forms. Xaml. ElementNode’ to type ‘Xamarin. Forms. Xaml. ValueNode’.

When writing XAML for Xamarin Forms, you may across the error:

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

This is nearly always caused by assigning a value to an event in XAML, instead of specifying a method name.

A common example is:

<Switch Toggled="{Binding IsToggled}" />

Toggled is the name of an event. The property that was probably intended is called IsToggled.

<Switch IsToggled="{Binding IsToggled}" />

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s