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!

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)