title: Two-way data binding objects
body: <p>I used an application recently that was awe-inspiring. All the forms inherited from their own classes and a 'form' came with an amazing amount of functionality and looked the nuts.</p>
  
  <p>What I'm interested in is this 'feature' of the form. This was a C# WinForms project and blew me away.</p>
  
  <p>The forms were bound to objects that the group had written to support two-way data binding (to an extent). The way they behaved was pretty simple:</p>
  
  <p>The data input forms all had controls that inherited from textbox and these were bound to properties of an object, Entering data immediately validated it and the box was a light pink if validation failed and a light green if it passed. If the box ever turns blue this actually means the value in the database the form is bound to has changed and your changes to the controls were immediately saved when valid values entered. It was the case that sometimes a section of controls had to be filled before a save occured. But it was all automatic. You could stop at any point and come back later and continue without actually saving yourself.</p>
  
  <p>And like I say if someone else is editing the same record values they change caused your textboxes to become blue and you knew you needed to reload the screen to see up to date information.</p>
  
  <p>All of this came from using their own form class they had written and their  own textbox controls bound to an objects property.</p>
  
  <p>I'm mainly wondering how the hell did the object figure out the value had been changed by someone else. It surely isn't polling the database. This system was amazing. The brilliance didn't stop there.</p>
  
  <p>For simplicity. How might I create an object or collection of objects to mimic the bahaviour. I'm not going to but I can't even see how.</p>
  
  <p>Thanks</p>