public wfQueryControlSelectorResult Attr <T>(string name, Func <int, Control, T> func) { if (0 == Length) { return(this); } IAttributeProvider provider = wfQueryContext.DefaultAttributeProvider; LinkedListNode <Control> node = Results.First; _wfQuery.Control.SuspendLayout(); for (int index = 0; index < Length; index++) { Control control = node.Value; PropertyInfo property = GetProperty(control, name); if (null == property) { provider.SetAttributeValue(control, name, func(index, control)); } else { property.SetValue(control, func(index, control)); } node = node.Next; } _wfQuery.Control.ResumeLayout(); return(this); }
public wfQueryControlSelectorResult Attr <T>(string name, T value) { if (0 == Length) { return(this); } IAttributeProvider provider = wfQueryContext.DefaultAttributeProvider; _wfQuery.Control.SuspendLayout(); foreach (Control control in Results) { PropertyInfo property = GetProperty(control, name); if (null == property) { provider.SetAttributeValue(control, name, value); } else { property.SetValue(control, value); } } _wfQuery.Control.ResumeLayout(); return(this); }