예제 #1
0
        void IPropertyValidatorContainer.AddValidator <TProperty>(string propertyName, PropertyValidator <TProperty> validator)
        {
            List <PropertyValidatorBase> validatorList;

            if (!ValidationMap.TryGetValue(propertyName, out validatorList))
            {
                validatorList = new List <PropertyValidatorBase>();
                ValidationMap.Add(propertyName, validatorList);
            }

            validatorList.Add(validator);
        }
예제 #2
0
        protected void ValidateProperty(string propertyName)
        {
            Debug.Assert(propertyName != null, "propertyName != null");

            List <ValidationBinder> binder;

            if (ValidationMap.TryGetValue(propertyName, out binder))
            {
                binder.ForEach(b => b.Update());
                RaiseErrorsChanged(propertyName);
            }
        }
예제 #3
0
        internal void AddValidation(string propertyName, ValidationBinder binder)
        {
            List <ValidationBinder> bindList;

            if (!ValidationMap.TryGetValue(propertyName, out bindList))
            {
                bindList = new List <ValidationBinder>();
                ValidationMap.Add(propertyName, bindList);
            }

            bindList.Add(binder);
        }
예제 #4
0
        private void ClearValidationErrors(string propertyName)
        {
            List <PropertyValidatorBase> validatorList;

            if (!ValidationMap.TryGetValue(propertyName, out validatorList))
            {
                return;
            }

            foreach (var v in validatorList)
            {
                v.Clear();
            }

            RaiseErrorsChanged(propertyName);
        }
예제 #5
0
        private void ValidateProperty(string propertyName)
        {
            List <PropertyValidatorBase> validatorList;

            if (!ValidationMap.TryGetValue(propertyName, out validatorList))
            {
                return;
            }

            var value = GetPropertyValue(propertyName);

            validatorList.ForEach(b =>
            {
                if (!b.IsManual)
                {
                    b.Update(value);
                }
            });
            RaiseErrorsChanged(propertyName);
        }