Exemplo n.º 1
0
        private void UpdateErrors()
        {
            _errors.Clear();
            foreach (var current in new List <WeakReference <FrameworkElement> >(_controls))
            {
                FrameworkElement control;
                if (!current.TryGetTarget(out control))
                {
                    _controls.Remove(current);
                    continue;
                }
                foreach (var err in System.Windows.Controls.Validation.GetErrors(control))
                {
                    _errors.Add(err);
                }
            }
            foreach (var current in new List <WeakReference <ValidationFrame> >(_childFrames))
            {
                ValidationFrame frame;
                if (!current.TryGetTarget(out frame))
                {
                    _childFrames.Remove(current);
                    continue;
                }
                foreach (var err in frame.Errors)
                {
                    _errors.Add(err);
                }
            }

            if (_parentFrame != null)
            {
                _parentFrame.UpdateErrors();
            }
        }