.NET Framework Class Library
DependencyPropertyDescriptor..::.AddValueChanged Method

Enables other objects to be notified when this property changes.

Namespace:  System.ComponentModel
Assembly:  WindowsBase (in WindowsBase.dll)
Syntax

Visual Basic (Declaration)
Public Overrides Sub AddValueChanged ( _
    component As Object, _
    handler As EventHandler _
)
Visual Basic (Usage)
Dim instance As DependencyPropertyDescriptor
Dim component As Object
Dim handler As EventHandler

instance.AddValueChanged(component, handler)
C#
public override void AddValueChanged(
    Object component,
    EventHandler handler
)
Visual C++
public:
virtual void AddValueChanged(
    Object^ component, 
    EventHandler^ handler
) override
JScript
public override function AddValueChanged(
    component : Object, 
    handler : EventHandler
)
XAML
You cannot use methods in XAML.

Parameters

component
Type: System..::.Object
The component to add the handler for.
handler
Type: System..::.EventHandler
The delegate to add as a listener.
Platforms

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.
Version Information

.NET Framework

Supported in: 3.5, 3.0
See Also

Reference

Tags :


Community Content

Paul Meyer
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.


Page view tracker