Пример #1
0
        private static void ValidationScopeChanged(DependencyObject source, DependencyPropertyChangedEventArgs args)
        {
            ValidationScope oldScope = args.OldValue as ValidationScope;

            if (oldScope != null)
            {
                oldScope.ScopeElement.BindingValidationError -= oldScope.ScopeElement_BindingValidationError;
                oldScope.ScopeElement = null;
            }

            FrameworkElement scopeElement = source as FrameworkElement;

            if (scopeElement == null)
            {
                throw new ArgumentException(string.Format(
                                                "'{0}' is not a valid type.ValidationScope attached property can only be specified on types inheriting from FrameworkElement.",
                                                source));
            }

            ValidationScope newScope = (ValidationScope)args.NewValue;

            newScope.ScopeElement = scopeElement;
            newScope.ScopeElement.BindingValidationError += newScope.ScopeElement_BindingValidationError;
        }
Пример #2
0
 public static void SetValidationScope(DependencyObject obj, ValidationScope value)
 {
     obj.SetValue(ValidationScopeProperty, value);
 }
Пример #3
0
 public static void SetValidationScope(DependencyObject obj, ValidationScope value)
 {
     obj.SetValue(ValidationScopeProperty, value);
 }
Пример #4
0
 public MainPageModel(Project currentProject)
 {
     _currentProject = currentProject;
     ValidationScope1 = new ValidationScope();
 }
Пример #5
0
 public MainPageModel(Project currentProject)
 {
     _currentProject  = currentProject;
     ValidationScope1 = new ValidationScope();
 }