A particular build/compile error in my Silverlight project has been plaguing me today. Unfortunately while changing a million things in a Xaml view, I managed to stuff it up chronic. So much so, that it was a nightmare to trace back to the root cause. Funny that… it smacks to me of a similar time I had Xaml compilation error 60 but this is different.
Problem:
Compiling my Silverlight 3 application prompted the following error.
Error 1: The "ValidateXaml" task failed unexpectedly.
Could be a number of things, but firstly check if you had a CheckBox defined in your Xaml, and that you changed something on it. If you do, then it’s most likely the culprit and read on…
Solution:
In my particular case, CheckBox was incorrectly bound for it’s checked/ticked state.
<CheckBox Checked = "{Binding Path=SomeProperty"} />
Seems innocent doesn’t it. However, the Checked attribute of the CheckBox is actually an event, not a property! This causes the build task to blow a fuse – wish it would actually tell me the proper reason.
Thus the , proper syntax is…
<CheckBox IsChecked = "{Binding Path=SomeProperty"} />
I hope that saved you a bit of head scratching!