Ejemplo n.º 1
0
        protected override void CreateChildControls()
        {
            base.CreateChildControls();
            for (int i = 0; i < this._menuItems.Count; i++)
            {
                DynamicMenuItem item = this._menuItems[i];

                DynamicMenuPopoutItem ctrl = new DynamicMenuPopoutItem(item, this._itemStyle, this._aciveItemStyle, this._hoverItemStyle);
                ctrl.SelectorMode       = this._selectorMode;
                ctrl.ParentGroup        = this;
                ctrl.MenuItemClicked   += new DynamicMenuEventHandler(ctrl_MenuItemClicked);
                ctrl.MenuItemRendering += new DynamicMenuItemRenderingEventHandler(ctrl_MenuItemRendering);
                this.Controls.Add(ctrl);

                if (item.MenuItems.Count > 0)
                {
                    DynamicMenuPopoutGroup ctrlGrp = new DynamicMenuPopoutGroup(item.MenuItems, this._itemStyle, this._aciveItemStyle, this._hoverItemStyle);
                    ctrlGrp.SelectorMode       = this._selectorMode;
                    ctrlGrp._isSubMenu         = true;
                    ctrlGrp.MenuItemClicked   += new DynamicMenuEventHandler(ctrl_MenuItemClicked);
                    ctrlGrp.MenuItemRendering += new DynamicMenuItemRenderingEventHandler(ctrl_MenuItemRendering);
                    this.Controls.Add(ctrlGrp);
                    this._assocDivs.Add(ctrlGrp.ClientID, item.MenuItemProviderKey.ToString());
                }

                this.Controls.Add(ctrl);
            }
        }
Ejemplo n.º 2
0
        internal void HideSubMenu(object menuItemProviderKey)
        {
            string clientID = this._assocDivs[menuItemProviderKey.ToString()];
            DynamicMenuPopoutGroup subMenu = null;

            for (int i = 0; i < this.Controls.Count; i++)
            {
                if (this.Controls[i].ClientID == clientID)
                {
                    subMenu = (this.Controls[i] as DynamicMenuPopoutGroup); break;
                }
            }
            if (subMenu != null)
            {
                subMenu._expanded = false;
            }
        }
Ejemplo n.º 3
0
        protected override void CreateChildControls()
        {
            base.CreateChildControls();
            for (int i = 0; i < this._menuItems.Count; i++)
            {
                DynamicMenuItem item = this._menuItems[i];

                DynamicMenuPopoutItem ctrl = new DynamicMenuPopoutItem(item, this._itemStyle, this._aciveItemStyle, this._hoverItemStyle);
                ctrl.SelectorMode = this._selectorMode;
                ctrl.ParentGroup = this;
                ctrl.MenuItemClicked += new DynamicMenuEventHandler(ctrl_MenuItemClicked);
                ctrl.MenuItemRendering += new DynamicMenuItemRenderingEventHandler(ctrl_MenuItemRendering);
                this.Controls.Add(ctrl);

                if (item.MenuItems.Count > 0)
                {
                    DynamicMenuPopoutGroup ctrlGrp = new DynamicMenuPopoutGroup(item.MenuItems, this._itemStyle, this._aciveItemStyle, this._hoverItemStyle);
                    ctrlGrp.SelectorMode = this._selectorMode;
                    ctrlGrp._isSubMenu = true;
                    ctrlGrp.MenuItemClicked += new DynamicMenuEventHandler(ctrl_MenuItemClicked);
                    ctrlGrp.MenuItemRendering += new DynamicMenuItemRenderingEventHandler(ctrl_MenuItemRendering);
                    this.Controls.Add(ctrlGrp);
                    this._assocDivs.Add(ctrlGrp.ClientID, item.MenuItemProviderKey.ToString());
                }

                this.Controls.Add(ctrl);
            }
        }
Ejemplo n.º 4
0
        protected override void CreateChildControls()
        {
            if (string.IsNullOrEmpty(this.MenuName))
                throw new Exception("You must specify the name of the menu to build.");
            this.LoadMenu(this.MenuName);

            if (this._items == null)
                throw new Exception("MenuItemCollection has not been initialized!");
            DynamicMenuChildControl ctrl = null;
            switch (this.RenderMode)
            {
                case DynamicMenuRenderType.HoverHorizontal:
                    throw new NotImplementedException();

                case DynamicMenuRenderType.HoverVertical:
                    throw new NotImplementedException();

                case DynamicMenuRenderType.Icon:
                    for (int i = 0; i < this._items.Count; i++)
                    {
                        ctrl = new DynamicMenuIconGroup(this._items[i], this._menuItemStyle, this._activeMenuItemStyle, this._menuItemHoverStyle);
                        if (this._designMode)
                            ctrl.SelectorMode = true;
                        ctrl.MenuItemClicked += new DynamicMenuEventHandler(this.childCtrl_OnClick);
                        ctrl.MenuItemRendering += new DynamicMenuItemRenderingEventHandler(this.childCtrl_OnRendering);
                        this.Controls.Add(ctrl);
                    }
                    break;

                case DynamicMenuRenderType.Popout:
                    {
                        ctrl = new DynamicMenuPopoutGroup(this._items, this._menuItemStyle, this._activeMenuItemStyle, this._menuItemHoverStyle);
                        if (this._designMode)
                            ctrl.SelectorMode = true;
                        ctrl.MenuItemClicked += new DynamicMenuEventHandler(this.childCtrl_OnClick);
                        ctrl.MenuItemRendering += new DynamicMenuItemRenderingEventHandler(this.childCtrl_OnRendering);
                        this.Controls.Add(ctrl);
                    }
                    break;

                default:
                    throw new Exception("Unrecognized DynamicMenuRenderType value.");
            }
            base.CreateChildControls();
        }