public bool InsertComponent(UIBaseComponent newComp, int atPosition)
        {
            if (newComp == null)
            {
                return(false);
            }

            if (WillAddComponent(newComp) == false)
            {
                return(false);
            }

            if (newComp.ParentComponent != null)
            {
                newComp.ParentComponent.RemoveComponent(newComp);
            }

            newComp.ParentComponent = this;
            components.Insert(atPosition, newComp);
            newComp.PerformLayout();

            DidAddComponent(newComp);

            return(true);
        }
        /// <summary>
        /// Adds the component.
        /// </summary>
        /// <returns><c>true</c>, if component was added, <c>false</c> otherwise.</returns>
        public bool AddComponent(UIBaseComponent newComp)
        {
            if (newComp == null)
            {
                return(false);
            }

            if (WillAddComponent(newComp) == false)
            {
                return(false);
            }

            if (newComp.ParentComponent != null)
            {
                newComp.ParentComponent.RemoveComponent(newComp);
            }

            newComp.ParentComponent = this;
            components.Add(newComp);
            newComp.PerformLayout();

            DidAddComponent(newComp);

            return(true);
        }
        public bool RemoveComponent(UIBaseComponent comp)
        {
            if (comp == null)
            {
                return(false);
            }

            if (WillRemoveComponent(comp) == false)
            {
                return(false);
            }

            if (components.Contains(comp))
            {
                components.Remove(comp);
            }
            comp.ParentComponent = null;
            comp.PerformLayout();

            DidRemoveComponent(comp);

            return(true);
        }