Ejemplo n.º 1
0
        /// <summary>
        /// Creates the popup container control which is a parent/holder control for the controls you want to display on the popup.
        /// This method can be used if you do not wish to handle the PopupContainerLoad to add controls to the popup container.
        /// After calling this method you can access PopupContainerControl property to add your controls to be displayed on the popup.
        /// </summary>
        /// <param name="fireLoadEvents">Indicates whether PopupContainerLoad events are fired.</param>
        public virtual void CreatePopupContainer(bool fireLoadEvents)
        {
            if (this.PopupType != ePopupType.Container)
                throw new InvalidOperationException("Method can only be called for PopupType set to ePopupType.Container");

            if (m_PopupContainer == null)
            {
                m_PopupContainer = new PopupContainerControl();
                m_PopupContainer.Owner = this.GetOwner();
                m_PopupContainer.ParentItem = this;
                m_PopupContainer.CreateControl();
                m_PopupContainer.SetDesignMode(this.DesignMode);
                m_PopupContainer.Width = m_PopupWidth;

                if (fireLoadEvents)
                {
                    IOwnerMenuSupport ownerMenu = this.GetIOwnerMenuSupport();
                    // Fire off events
                    if (PopupContainerLoad != null)
                        PopupContainerLoad(this, new EventArgs());
                    if (ownerMenu != null)
                        ownerMenu.InvokePopupContainerLoad(this, new EventArgs());

                    // Recalc Size would go here...
                    m_PopupContainer.RecalcSize();
                }
            }
        }