Esempio n. 1
0
        /// <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(HorizontalAlignment.ToClass());

            var html = new HtmlElementMultimediaImg()
            {
                ID    = ID,
                Class = GetClasses(),
                Style = GetStyles(),
                Role  = Role,
                Alt   = Tooltip,
                Src   = Uri?.ToString(),
            };

            if (!string.IsNullOrWhiteSpace(Tooltip))
            {
                html.AddUserAttribute("data-toggle", "tooltip");
                html.AddUserAttribute("title", Tooltip);
            }

            if (Width > 0)
            {
                html.AddUserAttribute("width", Width.ToString());
            }

            if (Height > 0)
            {
                html.AddUserAttribute("height", Height.ToString());
            }

            return(html);
        }
Esempio n. 2
0
        /// <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 img = new HtmlElementMultimediaImg()
            {
                Src   = Image?.ToString(),
                Class = "mr-3 mt-3 " // rounded-circle
            };

            if (ImageWidth > -1)
            {
                img.Width = ImageWidth;
            }

            if (ImageHeight > -1)
            {
                img.Height = ImageHeight;
            }

            var heading = new HtmlElementSectionH4(Title?.Render(context))
            {
            };

            var body = new HtmlElementTextContentDiv(Title != null ? heading : null)
            {
                Class = "media-body"
            };

            body.Elements.AddRange(from x in Content select x.Render(context));

            var html = new HtmlElementTextContentDiv(img, body)
            {
                ID    = ID,
                Class = Css.Concatenate("media", GetClasses()),
                Style = GetStyles(),
                Role  = Role
            };

            return(html);
        }