Click here to Skip to main content
15,843,145 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi,
i was creating a DependencyProperty Changed with a callback method using the following code:
C#
public void RegisterForNotification(string propertyName, FrameworkElement element, PropertyChangedCallback callback) 
        { 
 
            Binding b = new Binding(propertyName) { Source = element }; 
            var prop = System.Windows.DependencyProperty.RegisterAttached( 
                "ListenAttached" + propertyName, 
                typeof(object), 
                typeof(UserControl), 
                new System.Windows.PropertyMetadata(callback));              
            element.SetBinding(prop, b); 
        }


The callback method caused a memory leak in my application, how can i unregister this callback method?

thanks in advance.
Posted

1 solution

Take a look at this post stackoverflow site
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900