コード例 #1
0
        internal void BeginMenu(MenuType type, bool isInversed)
        {
            _menuTag = new TagBuilderExt("div");
            _menuTag.AddCssClass("navbar-default");
            _menuTag.AddCssClass("navbar");

            switch (type)
            {
            case MenuType.FixedTop:
                _menuTag.AddCssClass("navbar-fixed-top");
                break;

            case MenuType.FixedBottom:
                _menuTag.AddCssClass("navbar-fixed-bottom");
                break;

            case MenuType.StaticTop:
                _menuTag.AddCssClass("navbar-static-top");
                break;
            }

            if (isInversed)
            {
                _menuTag.AddCssClass("navbar-inverse");
            }
            var inner = new TagBuilderExt("div");

            inner.AddCssClass("container");
            _menuTag.AddChildTag(inner);

            _context.Writer.WriteLine(_menuTag.ToString(TagRenderMode.StartTag));
        }
コード例 #2
0
        /// <summary>
        /// Creates the opening tag for the Menu Item container.
        /// </summary>
        internal void BeginMenuItems()
        {
            _listTag = new TagBuilderExt("ul");
            _listTag.AddCssClass("nav");

            _context.Writer.WriteLine(_listTag.ToString(TagRenderMode.StartTag));
        }
コード例 #3
0
        /// <summary>
        /// Closes the Menu Item container tag.
        /// </summary>
        internal void StopMenu()
        {
            if (_isStopped)
            {
                return;
            }

            _context.Writer.WriteLine(MvcHtmlString.Create(_listTag.ToString(TagRenderMode.EndTag)));
            _isStopped = true;
        }