protected override ValidationMessage <TOwner> CreateAssociatedControl(Control <TOwner> control) { var validationMessageDefinition = UIComponentResolver.GetControlDefinition(typeof(ValidationMessage <TOwner>)); PlainScopeLocator scopeLocator = new PlainScopeLocator(By.XPath("ancestor::" + validationMessageDefinition.ScopeXPath)) { SearchContext = control.Scope }; return(Component.Controls.Create <ValidationMessage <TOwner> >(control.ComponentName, scopeLocator)); }
/// <summary> /// Fors the specified control selector. /// </summary> /// <param name="controlSelector"> /// The control selector. /// </param> /// <returns></returns> public ValidationMessage <TOwner> For(Func <TOwner, IControl <TOwner> > controlSelector) { var validationMessageDefinition = UIComponentResolver.GetControlDefinition(typeof(ValidationMessage <TOwner>)); IControl <TOwner> boundControl = controlSelector(Component.Owner); PlainScopeLocator scopeLocator = new PlainScopeLocator(By.XPath("ancestor::" + validationMessageDefinition.ScopeXPath)) { SearchContext = boundControl.Scope }; return(Component.Controls.Create <ValidationMessage <TOwner> >(boundControl.ComponentName, scopeLocator)); }