DependencyPropertyDescriptor.AddValueChanged Method
Enables other objects to be notified when this property changes.
Assembly: WindowsBase (in WindowsBase.dll)
Parameters
- component
- Type: System.Object
The component to add the handler for.
- handler
- Type: System.EventHandler
The delegate to add as a listener.
Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
DependencyPropertyDescriptor.AddValueChanged roots your component for GC! (object leak)
Beware that this method will ultimately store a reference to 'component' as a key in a static hashtable. This will root your component and it will never be garbage collected, unless you call RemoveValueChanged when you are done.
Consider implementing (and using) IDisposable or using a weak reference method, such as data binding through a Binding object. Also see http://agsmith.wordpress.com/2008/04/07/propertydescriptor-addvaluechanged-alternative/ for a discussion.
- 9/9/2009
- Paul Meyer