C# 클래스 ControlzEx.Helper.PropertyChangeNotifier

AddValueChanged of dependency property descriptor results in memory leak as you already know. So, as described here, you can create custom class PropertyChangeNotifier to listen to any dependency property changes. This class takes advantage of the fact that bindings use weak references to manage associations so the class will not root the object who property changes it is watching. It also uses a WeakReference to maintain a reference to the object whose property it is watching without rooting that object. In this way, you can maintain a collection of these objects so that you can unhook the property change later without worrying about that collection rooting the object whose values you are watching. Complete implementation can be found here: http://agsmith.wordpress.com/2008/04/07/propertydescriptor-addvaluechanged-alternative/
상속: System.Windows.DependencyObject, IDisposable
파일 보기 프로젝트 열기: ControlzEx/ControlzEx

공개 프로퍼티들

프로퍼티 타입 설명
ValueProperty System.Windows.DependencyProperty

Private Properties

프로퍼티 타입 설명
OnPropertyChanged void

공개 메소드들

메소드 설명
Dispose ( ) : void
PropertyChangeNotifier ( DependencyObject propertySource, DependencyProperty property ) : System
PropertyChangeNotifier ( DependencyObject propertySource, PropertyPath property ) : System
PropertyChangeNotifier ( DependencyObject propertySource, string path ) : System

비공개 메소드들

메소드 설명
OnPropertyChanged ( DependencyObject d, System.Windows.DependencyPropertyChangedEventArgs e ) : void

메소드 상세

Dispose() 공개 메소드

public Dispose ( ) : void
리턴 void

PropertyChangeNotifier() 공개 메소드

public PropertyChangeNotifier ( DependencyObject propertySource, DependencyProperty property ) : System
propertySource System.Windows.DependencyObject
property System.Windows.DependencyProperty
리턴 System

PropertyChangeNotifier() 공개 메소드

public PropertyChangeNotifier ( DependencyObject propertySource, PropertyPath property ) : System
propertySource System.Windows.DependencyObject
property System.Windows.PropertyPath
리턴 System

PropertyChangeNotifier() 공개 메소드

public PropertyChangeNotifier ( DependencyObject propertySource, string path ) : System
propertySource System.Windows.DependencyObject
path string
리턴 System

프로퍼티 상세

ValueProperty 공개적으로 정적으로 프로퍼티

Identifies the Value dependency property
public static DependencyProperty,System.Windows ValueProperty
리턴 System.Windows.DependencyProperty