public void SetValidationRule(Control control, ValidationRule rule) { if (control == null) { throw new ArgumentNullException("control"); } if (rule == null) { throw new ArgumentNullException("rule"); } var info = this.controls.GetValueOrDefault(control); if (info == null) { info = new ControlInfo(EditorAdapterFactory.Create(control)); this.SubscribeValidatingEvent(control); this.controls[control] = info; } info.Rule = rule; }