/// <summary> /// In HTML konvertieren /// </summary> /// <param name="context">Der Kontext, indem das Steuerelement dargestellt wird</param> /// <returns>Das Control als HTML</returns> public override IHtmlNode Render(RenderContext context) { Classes.Add("timeline"); var ul = new HtmlElementTextContentUl(Items.Select(x => new HtmlElementTextContentLi(x.Render(context)) { Class = "item" })) { ID = ID, Class = string.Join(" ", Classes.Where(x => !string.IsNullOrWhiteSpace(x))), Style = string.Join("; ", Styles.Where(x => !string.IsNullOrWhiteSpace(x))), Role = Role }; return(ul); }
/// <summary> /// In HTML konvertieren /// </summary> /// <param name="context">Der Kontext, indem das Steuerelement dargestellt wird</param> /// <returns>Das Control als HTML</returns> public override IHtmlNode Render(RenderContext context) { var button = new HtmlElementTextSemanticsA() { ID = string.IsNullOrWhiteSpace(ID) ? "" : ID + "_btn", Class = Css.Concatenate("btn", Css.Remove(GetClasses(), Margin.ToClass())), Style = GetStyles(), Target = Target, Href = Uri?.ToString() }; if (Icon != null && Icon.HasIcon) { button.Elements.Add(new ControlIcon() { Icon = Icon, Margin = !string.IsNullOrWhiteSpace(Text) ? new PropertySpacingMargin ( PropertySpacing.Space.None, PropertySpacing.Space.Two, PropertySpacing.Space.None, PropertySpacing.Space.None ) : new PropertySpacingMargin(PropertySpacing.Space.None), VerticalAlignment = Icon.IsUserIcon ? TypeVerticalAlignment.TextBottom : TypeVerticalAlignment.Default }.Render(context)); } if (!string.IsNullOrWhiteSpace(Text)) { button.Elements.Add(new HtmlText(Text)); } if (Modal != null) { button.AddUserAttribute("data-toggle", "modal"); button.AddUserAttribute("data-target", "#" + Modal.ID); } var dropdownButton = new HtmlElementTextSemanticsSpan(new HtmlElementTextSemanticsSpan() { Class = "caret" }) { ID = string.IsNullOrWhiteSpace(ID) ? "" : ID + "_btn", Class = Css.Concatenate("btn dropdown-toggle dropdown-toggle-split", Css.Remove(GetClasses(), "btn-block", Margin.ToClass())), Style = GetStyles(), DataToggle = "dropdown" }; var dropdownElements = new HtmlElementTextContentUl ( Items.Select ( x => x == null || x is ControlDropdownItemDivider || x is ControlLine ? new HtmlElementTextContentLi() { Class = "dropdown-divider", Inline = true } : x is ControlDropdownItemHeader ? x.Render(context) : new HtmlElementTextContentLi(x.Render(context)) { Class = "dropdown-item" } ) ) { Class = HorizontalAlignment == TypeHorizontalAlignment.Right ? "dropdown-menu dropdown-menu-right" : "dropdown-menu" }; var html = new HtmlElementTextContentDiv ( Modal != null ? (IHtmlNode) new HtmlList(button, Modal.Render(context)) : button, dropdownButton, dropdownElements ) { Class = Css.Concatenate ( "btn-group ", Margin.ToClass(), (Block == TypeBlockButton.Block ? "btn-block" : "") ), Role = Role }; return(html); }