WTF Moment: Data Binding Error
A few weeks ago, I was updating Jing’s splash screen because of some underyling classes that I refactored when I encountered an exception thrown in a MultiBindingConverter for trying to read DependencyProperty.UnsetValue as an enum.
The MultiBindingConverter was blowing up in XAML that looked similar to:

After a few hours of gnashing my teeth, and cursing under my breath, I fixed this error. The culprit was with the declaration of one of the properties:
internal AnEnum SomeProperty2…
When I declared the property as public, everything worked. To be absolutely honest, I have no clue why this fixed it, as I’ve never seen anything in the MSDN docs stating you could only do MultiBinding on public properties. This is a slight annoyance, as that property really should have been internal, and making it public to make MultiBinding work broke some encapsulation.
Maybe I’ll use Reflector one day to poke around the WPF classes and see if there’s a clue as to why this is.
A “WTF” moment, indeed.
Tags: data binding, DependencyProperty.UnsetValue, internal, public
You can comment below, or link to this permanent URL from your own site.