Esempio n. 1
0
        private static void OnErrorsProxyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            var node = (ErrorNode)d.GetValue(Scope.ErrorsProperty);

            if (node == null)
            {
                // this happens when disposing
                return;
            }

            var oldValue = (ReadOnlyObservableCollection <ValidationError>)e.OldValue;

            if (oldValue != null)
            {
                CollectionChangedEventManager.RemoveListener(oldValue, node);
            }

            var newValue = (ReadOnlyObservableCollection <ValidationError>)e.NewValue;

            if (newValue != null)
            {
                CollectionChangedEventManager.AddListener(newValue, node);
            }

            node.RefreshErrors();
            BubbleRoute.Notify(node);
        }
Esempio n. 2
0
        bool IWeakEventListener.ReceiveWeakEvent(Type managerType, object sender, EventArgs e)
        {
            if (managerType == typeof(CollectionChangedEventManager))
            {
                this.RefreshErrors();
                BubbleRoute.Notify(this);
                return(true);
            }

            return(false);
        }
Esempio n. 3
0
        protected override void Dispose(bool disposing)
        {
            if (!disposing)
            {
                return;
            }

            var source = this.Source;

            if (source != null)
            {
                var value = source.GetValue(ErrorsProxyProperty);
                if (value != null)
                {
                    CollectionChangedEventManager.RemoveListener((INotifyCollectionChanged)value, this);
                }

                BindingOperations.ClearBinding(source, ErrorsProxyProperty);
                this.RefreshErrors();
                BubbleRoute.Notify(this);
            }
        }