Change the PropertyChangeTracker.OnPropertyInvalidation method to raise Changed event with meaningful EventArgs object...
Change the MS.Internal.ComponentModel.PropertyChangeTracker.OnPropertyInvalidation method to raise Changed event with meaningful EventArgs object, which tells which DependencyProperty is changed.
I am using the following code-construct to wire-up event handler for DependencyProperty changes:
public void WireUp( DependencyObject obj, DependencyProperty prop )
var dpd = DependencyPropertyDescriptor.FromProperty( prop, obj.GetType() );
dpd.AddValueChanged( obj, ValueChangedEventHandler );
private void ValueChangedEventHandler( object sender, EventArgs e )
Unfortunately the EventArgs e represents an EventArgs.Empty object inside the event handler method block, which makes impossible to track which DependencyProperty was changed.
As I see in the reference-source (http://referencesource.microsoft.com/#WindowsBase/Base/MS/Internal/ComponentModel/PropertyChangeTracker.cs,6c03ba1a17c9b49b) the MS.Internal.ComponentModel.PropertyChangeTracker.OnPropertyInvalidation method raises the Changed event with EventArgs.Empty object. It would be simple to pass the “DependencyPropertyChangedEventArgs args” method-argument instead of EventArgs.Empty, but it’s not inherited from System.EventArgs class.
Nevertheless, it would be nice to have some info about which DependencyProperty was changed.