Click to Rate and Give Feedback
MSDN
MSDN Library
.NET Development
.NET Framework 3.5
 AddValueChanged Method
Collapse All/Expand All Collapse All
This page is specific to
Microsoft Visual Studio 2008/.NET Framework 3.5

Other versions are also available for the following:
.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)
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.

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.

.NET Framework

Supported in: 3.5, 3.0
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
DependencyPropertyDescriptor.AddValueChanged roots your component for GC! (object leak)      Paul Meyer   |   Edit   |   Show History

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.

Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks | Privacy Statement
Page view tracker