Exemplo n.º 1
0
 public ValidatedControlItem(ValidationProvider validationProvider, Control control)
 {
     this.validationProvider = validationProvider;
     this.control = control;
     this.control.Validating += this.OnValidating;
     this.isValid = true;
     this.validatedPropertyName = ValidationProvider.DefaultValidatedProperty;
 }
        /// <summary>
        /// Initialize a new instance of the <see cref="ValidatedControlItem"/> class with a <see cref="validationProvider"/> and a <see cref="Control"/>.
        /// </summary>
        /// <param name="validationProvider">The validation provider.</param>
        /// <param name="control">The control to validate.</param>
        public ValidatedControlItem(ValidationProvider validationProvider,
                                    Control control)
        {
            if (control == null) throw new ArgumentNullException("control");

            this.validationProvider = validationProvider;
            this.control = control;
            this.control.Validating += OnValidating;
            isValid = true;
            validatedPropertyName = ValidationProvider.DefaultValidatedProperty;
        }
        /// <summary>
        /// Initialize a new instance of the <see cref="ValidatedControlItem"/> class with a <see cref="validationProvider"/> and a <see cref="Control"/>.
        /// </summary>
        /// <param name="validationProvider">The validation provider.</param>
        /// <param name="control">The control to validate.</param>
        public ValidatedControlItem(ValidationProvider validationProvider,
                                    Control control)
        {
            if (control == null)
            {
                throw new ArgumentNullException("control");
            }

            this.validationProvider  = validationProvider;
            this.control             = control;
            this.control.Validating += OnValidating;
            isValid = true;
            validatedPropertyName = ValidationProvider.DefaultValidatedProperty;
        }
 public void AddControlValidation(string entityPropertyName, ValidationProvider validationProvider) {
     validationProvider.SetSourcePropertyName(txtWatchPath, entityPropertyName);
     validationProvider.SetValidatedProperty(txtWatchPath, "Text");
     validationProvider.SetPerformValidation(txtWatchPath, true);
 }