{"id":1068,"date":"2011-05-12T13:31:55","date_gmt":"2011-05-12T11:31:55","guid":{"rendered":"http:\/\/www.rare-it.com\/blog\/?p=1068"},"modified":"2011-05-12T13:31:55","modified_gmt":"2011-05-12T11:31:55","slug":"data-binding-pitfall","status":"publish","type":"post","link":"https:\/\/www.switchbl8.nl\/blog\/2011\/05\/data-binding-pitfall\/","title":{"rendered":"Data binding pitfall"},"content":{"rendered":"<p>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&#8217;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.<br \/>\nI 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!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>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&#8217;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 <a href='https:\/\/www.switchbl8.nl\/blog\/2011\/05\/data-binding-pitfall\/' class='excerpt-more'>[&#8230;]<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[49,128,87,90],"class_list":["post-1068","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-binding","tag-c","tag-wpf","tag-xaml","category-1-id","post-seq-1","post-parity-odd","meta-position-corners","fix"],"_links":{"self":[{"href":"https:\/\/www.switchbl8.nl\/blog\/wp-json\/wp\/v2\/posts\/1068","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.switchbl8.nl\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.switchbl8.nl\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.switchbl8.nl\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.switchbl8.nl\/blog\/wp-json\/wp\/v2\/comments?post=1068"}],"version-history":[{"count":0,"href":"https:\/\/www.switchbl8.nl\/blog\/wp-json\/wp\/v2\/posts\/1068\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.switchbl8.nl\/blog\/wp-json\/wp\/v2\/media?parent=1068"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.switchbl8.nl\/blog\/wp-json\/wp\/v2\/categories?post=1068"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.switchbl8.nl\/blog\/wp-json\/wp\/v2\/tags?post=1068"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}