Smart Property Changed Notification

Whenever a property changes in a property dependency network, the PDFx can optionally first analyze all the property dependencies and then fire the INotifyPropertyChanged.PropertyChanged event only once for every directly or indirectly dependent property. This analysis saves tremendous amounts of precious CPU time since every PropertyChanged event causes your UI layer to access and thereby reevaluate the bound properties.


By default, the smart property changed notification is turned on.
If you have a reason to switch this behavior off, you can set the Bindable class's UseSmartPropertyChangedNotificationByDefault Property to false.

Performance Demonstration

The source code of this example can be found in ViewModel SmartPropertyDependencyVM which is part of the WPFSample's source code.

Let us look at the following object graph:


Green circles stand for Input Properties while purple circles indicate calculated properties. The arrows show the underlying math operations as well as the property dependencies.

The number next to the lightning icon indicates how often the INotifyPropertyChanged.PropertyChanged event has fired since the D1 Property has changed the last time.

A change of D1 results in the following:


As the picture indicates, INotifyPropertyChanged.PropertyChanged is fired only once for every single property for maximum performance.

When the Smart Property Change Notification is switched off, a change of D1 results in the following:


In this scenario, the PDFx does not analyze the Property Dependency Network before INotifyPropertyChanged.PropertyChanged events are fired but rather blindly performs a depth-search traversal down the dependency tree along all directly and indirectly dependent properties and fires INotifyPropertyChanged.PropertyChanged for every single property it finds. As shown above, this behavior results in 10 PropertyChanged Notifications for the root node, A1.

To be more specific, the PDFx traverses the tree in the following manner, if smart property change notification is switched off:

D1 -> C1 -> B1 -> A1
	 -> B2 -> A1
   -> C2 -> B2 -> A1
         -> B3 -> A1
   -> C3 -> B3 -> A1
         -> B4 -> A1
   -> C4 -> B4 -> A1
         -> B5 -> A1
   -> C5 -> B5 -> A1
         -> B6 -> A1

It becomes obvious that the PropertyChanged event is inefficiently raised 10 times for Property A1 although once would be completely sufficient. Consequently, it is advisable to always take advantage of the smart property notification.

Last edited May 15, 2013 at 7:36 PM by KevinStumpf, version 8


No comments yet.