Exemplo n.º 1
0
        private void ConnectToParentFrame()
        {
            DependencyObject current = VisualTreeHelper.GetParent(this);

            while (current != null)
            {
                _parentFrame = current as ValidationFrame;
                if (_parentFrame != null)
                {
                    if (ValidatesOnDataErrors == null)
                    {
                        ValidatesOnDataErrors = _parentFrame.ValidatesOnDataErrors;
                    }
                    if (ValidatesOnExceptions == null)
                    {
                        ValidatesOnExceptions = _parentFrame.ValidatesOnExceptions;
                    }
                    if (ValidatesOnNotifyDataErrors == null)
                    {
                        ValidatesOnNotifyDataErrors = _parentFrame.ValidatesOnNotifyDataErrors;
                    }
                    foreach (var currentRule in _parentFrame.ValidationRules)
                    {
                        ValidationRules.Add(currentRule);
                    }
                    _parentFrame._childFrames.Add(new WeakReference <ValidationFrame>(this));
                    return;
                }
                current = VisualTreeHelper.GetParent(current);
            }
        }
Exemplo n.º 2
0
 private void ConnectToParentFrame()
 {
     DependencyObject current = VisualTreeHelper.GetParent(this);
     while(current!=null)
     {
         _parentFrame = current as ValidationFrame;
         if(_parentFrame!=null)
         {
             if (ValidatesOnDataErrors == null) ValidatesOnDataErrors = _parentFrame.ValidatesOnDataErrors;
             if (ValidatesOnExceptions == null) ValidatesOnExceptions = _parentFrame.ValidatesOnExceptions;
             if (ValidatesOnNotifyDataErrors == null) ValidatesOnNotifyDataErrors = _parentFrame.ValidatesOnNotifyDataErrors;
             foreach (var currentRule in _parentFrame.ValidationRules) ValidationRules.Add(currentRule);
             _parentFrame._childFrames.Add(new WeakReference<ValidationFrame>(this));
             return;
         }
         current = VisualTreeHelper.GetParent(current);
     }
 }