May 122011
 

I have been struggling with a databinding problem in WPF/XAML. To have some screen fields automatically update a class, I bound them to instantiated class (let’s call that myEmpData). In the XAML file I defined the path and source for each component to point to the class and a property in that class. The pitfall is that this creates a scoping problem. I could see the validation rules do their work, since my textboxes turned red whenever I entered incorrect values. But the underlying class was never changed. Or so it seemed.
I found out that you have to define your binding source as high as possible, I did it within the PAGE definition. Binding textboxes (or other components) to this source only requires you to specify the path. Now it works!