示例#1
0
        protected override void OnDetaching()
        {
            base.OnDetaching();
            this.AssociatedObject.Loaded      -= this.AssociatedObjectLoaded;
            this.AssociatedObject.TextChanged -= this.AssociatedObjectTextChanged;

            this.notifier = null;
        }
示例#2
0
        private void AssociatedObjectLoaded(object sender, System.Windows.RoutedEventArgs e)
        {
            this.adorner = new TextBlockAdorner(this.AssociatedObject, this.Label, this.LabelStyle);

            this.UpdateAdorner();

            //AddValueChanged for IsFocused in a weak manner
            this.notifier = new WeakPropertyChangeNotifier(this.AssociatedObject, UIElement.IsFocusedProperty);
            this.notifier.ValueChanged += new EventHandler(this.UpdateAdorner);
        }
示例#3
0
        private static void OnPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            WeakPropertyChangeNotifier notifier = (WeakPropertyChangeNotifier)d;

            notifier.ValueChanged?.Invoke(notifier, EventArgs.Empty);
        }