Exemple #1
0
        public override void RenderElement(RenderContext context, Action <TagBuilder> onRender = null)
        {
            if (SkipRender(context))
            {
                return;
            }
            Boolean bHasDropDown = DropDown != null;

            if (bHasDropDown)
            {
                DropDownDirection?dir     = (DropDown as DropDownMenu)?.Direction;
                Boolean           bDropUp = (dir == DropDownDirection.UpLeft) || (dir == DropDownDirection.UpRight);
                var wrap = new TagBuilder("div", "dropdown hlink-dd-wrapper", IsInGrid)
                           .AddCssClass(bDropUp ? "dir-up" : "dir-down")
                           .MergeAttribute("v-dropdown", String.Empty);
                onRender?.Invoke(wrap);
                if (!Block)
                {
                    wrap.AddCssClass("a2-inline");
                }
                if (Style != HyperlinkStyle.Default)
                {
                    wrap.AddCssClass(Style.ToString().ToLowerInvariant());
                }
                MergeAttributes(wrap, context, MergeAttrMode.Visibility);
                wrap.RenderStart(context);
                var hasAddOn = wrap.HasClass("add-on");
                RenderHyperlink(context, false, null, inside: true, addOn: hasAddOn);
                DropDown.RenderElement(context);
                wrap.RenderEnd(context);
            }
            else
            {
                RenderHyperlink(context, IsInGrid, onRender, false);
            }
        }