/// <summary> /// Simultaneously create UI and add to parent. /// </summary> /// <param name="parent"></param> /// <exception cref="Exception"></exception> public BaseControl(IControl parent) { if (parent.Canvas == null) { throw new Exception("Canvas must be set on the parent control before adding to a parent"); } Canvas = parent.Canvas; parent.Add(this); }