예제 #1
0
        public void AddItem(Expression <Func <T, object> > memberLambda, FrameworkElement control = null)
        {
            var item = new ValidatorItem <T>(memberLambda, control);

            _list.Add(item);

            //Create a function to call: Func<T, object> aa = memberLambda.Compile();
        }
예제 #2
0
        private void Viewmodel_PropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            ValidatorItem <T> found = null;

            for (int i = 0; i < _list.Count; i++)
            {
                ValidatorItem <T> item = _list[i];

                if (item.PropertyName == e.PropertyName)
                {
                    found = item;
                    break;
                }
            }

            if (found != null)
            {
                RaiseEvent(found);
            }
        }
예제 #3
0
        /// <summary>
        /// Returns the final value of the ValidateEventArgs.IsValid property.
        /// </summary>
        private bool RaiseEvent(ValidatorItem <T> validator_item)
        {
            ValidateEventArgs <T> e = new ValidateEventArgs <T>(validator_item.PropertyName);

            e.Remark = "";

            ValidateEvent?.Invoke(this, _viewmodel, e);

            //if (validator_item.Control != null)
            //{
            //FormField ff = VenturaVisualTreeHelper.FindParent<FormField>(validator_item.Control);

            if (validator_item.FormField != null)
            {
                validator_item.FormField.Remark = e.Remark;
            }

            //}

            return(e.IsValid);
        }
예제 #4
0
        public void AddItem(string validator_id, FrameworkElement control = null)
        {
            var item = new ValidatorItem <T>(validator_id, control);

            _list.Add(item);
        }