public TConcreteType AddNew <TControl>(TypedControlDelegate <TControl> controlSetHandler = null) where TControl : TChildrenType, new() { var control = new TControl(); if (controlSetHandler != null) { controlSetHandler.Invoke(control); } Children.Add(control); return(This); }
public static void ExtendControl <TControlType>(TypedControlDelegate <TControlType> extensionDelegate) where TControlType : HtmlObject { Assert.NullArgument(extensionDelegate, "extensionDelegate"); var controlType = typeof(TControlType); List <HtmlObjectDelegate> delegates = null; if (!_controlsExtensions.TryGetValue(controlType, out delegates)) { delegates = _controlsExtensions[controlType] = new List <HtmlObjectDelegate>(); } delegates.Add(new HtmlObjectDelegate((_control) => { try { extensionDelegate.Invoke((TControlType)_control); } catch (Exception ex) { throw new Exception("Error on control extension delegate", ex); } })); _extensionDelegatesMap.Clear(); CheckControlInheritanceTree(controlType); }
public static T OnDataBind <T>(this T control, TypedControlDelegate <T> handler) where T : HtmlObject { control.DataBindEvent += (ctrl) => handler.Invoke((T)ctrl); return(control); }
public static T Set <T>(this T control, TypedControlDelegate <T> handler) where T : HtmlObject { handler.Invoke(control); return(control); }
public static T OnPostRender <T>(this T control, TypedControlDelegate <T> handler) where T : HtmlObject { control.PostRenderEvent += (ctrl) => handler.Invoke((T)ctrl); return(control); }