internal virtual TagBuilder BuildDropdownMenu(ButtonDropdownContext buttonDropdownContext)
        {
            var dropdownMenu = base.BuildDropdownMenu(null);

            foreach (var child in buttonDropdownContext.ButtonOrDividers)
            {
                var dropdownItem = (TagBuilder)child;

                var dropdownItemClasses = dropdownItem.Attributes["class"];

                if (!dropdownItemClasses.Contains("dropdown-divider"))
                {
                    if (dropdownItemClasses.Contains("btn-default"))
                    {
                        dropdownItemClasses = dropdownItemClasses.Replace("btn-default", "btn-light");
                    }

                    dropdownItem.Attributes["class"] = $"dropdown-item btn-square {dropdownItemClasses}";
                }

                dropdownMenu.InnerHtml.AppendHtml(dropdownItem.ToHtml());
            }

            return(dropdownMenu);
        }
Пример #2
0
        internal override TagBuilder BuildDropdownMenu(ButtonDropdownContext buttonDropdownContext)
        {
            var dropdownMenu = base.BuildDropdownMenu(buttonDropdownContext);

            dropdownMenu.AddCssClass("dropdown-menu-right");

            return(dropdownMenu);
        }
        internal virtual TagBuilder BuildSplitLeftButton(ButtonDropdownContext buttonDropdownContext)
        {
            var leftButton = buttonDropdownContext.ButtonOrDividers.Select(t => (TagBuilder)t).Where(t => t.Attributes["class"].Contains("btn")).FirstOrDefault();

            if (leftButton.IsNotNull())
            {
                buttonDropdownContext.ButtonOrDividers.Remove(leftButton);

                leftButton.Attributes["class"] = SplitButtonClasses;
            }

            return(leftButton);
        }