Wednesday, November 28, 2012

Silverlight Binding Error

I ran into an error in Silverlight (v4) today and thought I might take a moment to document the problem in case anyone runs across the same issue.

I created a data grid and was assigning the columns manually.  I decided to leave one column without a binding because it will be a combo box field and I wasn't ready to tackle that yet.

When I ran my app I received and error when I bound my objects to the grid.  Since this is just a sandbox proof-of-concept thing I didn't have it wrapped with a try...catch so it actually came up as an unhandled exception in Internet Explorer.

The error will be "Value cannot be null."  And you might drill down and find an error about an unexpected value as well.

The problem is that you have a field without a binding.  So I removed this field (you may opt to add a binding to it) and problem solved.