public void Dispose() { INotifyPropertyChanged notify = DocumentContent; if(notify != null) notify.PropertyChanged -= this.updateHandler.Handler; this.updateHandler = null; DocumentContent = null; }
public void Dispose() { INotifyPropertyChanged notify = DocumentContent; if (notify != null) { notify.PropertyChanged -= this.updateHandler.Handler; } this.updateHandler = null; DocumentContent = null; }
public TitleUpdater(bool convertToString, object documentContentOrDocumentViewModel, DependencyObject target, DependencyProperty targetProperty) { TitleUpdater oldUpdater = (TitleUpdater)target.GetValue(TitleUpdaterInternalProperty); if(oldUpdater != null) oldUpdater.Dispose(); this.convertToString = convertToString; target.SetValue(TitleUpdaterInternalProperty, this); this.targetProperty = targetProperty; this.updateHandler = new PropertyChangedWeakEventHandler<DependencyObject>(target, OnDocumentViewModelPropertyChanged); INotifyPropertyChanged notify = documentContentOrDocumentViewModel as INotifyPropertyChanged; DocumentContent = notify; if(notify != null) notify.PropertyChanged += this.updateHandler.Handler; }
public TitleUpdater(bool convertToString, object documentContentOrDocumentViewModel, DependencyObject target, DependencyProperty targetProperty) { TitleUpdater oldUpdater = (TitleUpdater)target.GetValue(TitleUpdaterInternalProperty); if (oldUpdater != null) { oldUpdater.Dispose(); } this.convertToString = convertToString; target.SetValue(TitleUpdaterInternalProperty, this); this.targetProperty = targetProperty; this.updateHandler = new PropertyChangedWeakEventHandler <DependencyObject>(target, OnDocumentViewModelPropertyChanged); INotifyPropertyChanged notify = documentContentOrDocumentViewModel as INotifyPropertyChanged; DocumentContent = notify; if (notify != null) { notify.PropertyChanged += this.updateHandler.Handler; } }