Interesting thread on data binding

Yesterday I started a thread on the WPF Forum which has turned out to be rather interesting.  I won’t go into too much detail about it in this post, but here’s the general gist.  Normally the WPF data binding system requires a data object to send out notifications when one of its properties has changed so that the new value can be displayed in the UI.  There are three ways to do this:

  1. Raise a PropertyNameChanged event when a property has been changed (ex. Raise a NameChanged event when the Name property of an object is set).
  2. Implement INotifyPropertyChanged on the data object and raise its PropertyChanged event when a property is set to a new value.
  3. Derive the business object’s class from DependencyObject and implement the property as a dependency property.  DPs handle all of the change notification work for you.

As described on the thread I discovered an oddity where the new value of a property was appearing in the user interface, even though the data object emitted no property change notifications.  The answer to this mystery, as Douglas Stockwell figured out, has to do with the fact that the data binding system uses PropertyDescriptors to set the value of a property on the source object.  PropertyDescriptors have built-in value change notifications which they raise when setting a property on an object.  The binding system listens for change notifications sent out by PropertyDescriptors and, when they are raised, will update other Bindings which are bound to the same property on the source object.

For more information about this quirky, yet interesting, aspect of the WPF binding system check it out here.

4 Responses to Interesting thread on data binding

  1. oOgerryOo says:

    Hello,
    I’m Gerry.

    Just saying hey – I’m new.

  2. Pockererperef says:

    Hi,
    So, let’s chat! Any news?

  3. admin_papa says:

    Hello Everybody

    Just wanted to share my new experience.

    If your system fails to run due to an error related to lost HAL.DLL, invalid Boot.ini or any other important system boot files you can repair this by using the XP installation CD. Simply boot from your XP Setup CD and enter the Recovery Console. Then launch “attrib -H -R -S” on the C:\Boot.ini file and remove it. Launch “Bootcfg /Rebuild” and then Fixboot

    Cheers,
    Carl

  4. Sovavecouff says:

    Hello. It is test.

%d bloggers like this: