Example #1
0
        public static RequiredValidator SetRequiredValidation(this FrameworkElement uiElement, ValidatorManager validatorManager, string propertyDisplayName)
         {
             RequiredValidator rv = new RequiredValidator();
             rv.ErrorMessage = "REQUIRED";
             rv.ErrorMessageParameter = propertyDisplayName;
             rv.Manager = validatorManager;
             rv.ManagerName = validatorManager.Name;
             uiElement.SetValue(ValidatorService.ValidatorProperty, rv);

             return rv;
         }
Example #2
0
        private ValidatorManager FindManager(Control c, string groupName)
        {
            string defaultName = "_DefaultValidatorManager";
            var    mgr         = this.UserControl.FindName(ManagerName);

            if (mgr == null)
            {
                mgr = this.UserControl.FindName(defaultName);
            }
            if (mgr == null)
            {
                mgr = new ValidatorManager()
                {
                    Name = defaultName
                };
                Panel g = c.FindName("LayoutRoot") as Panel;
                g.Children.Add(mgr as ValidatorManager);
            }
            return(mgr as ValidatorManager);
        }
Example #3
0
 public void SetManagerAndControl(ValidatorManager manager, FrameworkElement element)
 {
     this.Manager           = manager;
     this.ElementToValidate = element;
 }