/// <summary> /// Adds new source with specified media and srcsets. /// </summary> /// <param name="picture"></param> /// <param name="media"></param> /// <param name="srcsets"></param> /// <returns></returns> public static IPictureElement Source(this IPictureElement picture, string media, params string[] srcsets) { foreach (string src in srcsets) { picture.Sources.Add(new SourceElement { Media = media, Srcset = srcsets }); } return(picture); }
public static MvcHtmlString RenderPicture(this HtmlHelper helper, IPictureElement picture) { return(new MvcHtmlString(picture.ToString())); }
/// <summary> /// Add multiple sources in the srcset attribute on img element /// </summary> /// <param name="picture"></param> /// <param name="srcset"></param> /// <returns></returns> public static IPictureElement Srcset(this IPictureElement picture, params string[] srcset) { picture.Srcset = srcset; return(picture); }
/// <summary> /// You should leave this empty /// </summary> /// <param name="picture"></param> /// <param name="src"></param> /// <returns></returns> public static IPictureElement Src(this IPictureElement picture, string src) { picture.Src = src; return(picture); }
/// <summary> /// Adds the following attribute and value to picture element. /// </summary> /// <param name="picture"></param> /// <param name="key"></param> /// <param name="value"></param> /// <returns></returns> public static IPictureElement Attr(this IPictureElement picture, string key, string value) { picture.Attributes.Add(key, value); return(picture); }
/// <summary> /// Adds the following attributes and values to picture element. /// </summary> /// <param name="picture"></param> /// <param name="attrs"></param> /// <returns></returns> public static IPictureElement Attrs(this IPictureElement picture, Dictionary <string, string> attrs) { picture.Attributes = attrs; return(picture); }
/// <summary> /// Convert to HtmlString /// </summary> /// <param name="picture"></param> /// <returns>Picture element as HtmlString</returns> public static IHtmlString Html(this IPictureElement picture) { return(new HtmlString(picture.ToString())); }
/// <summary> /// Sets the alt attribute on the img element. /// </summary> /// <param name="picture"></param> /// <param name="alt"></param> /// <returns></returns> public static IPictureElement Alt(this IPictureElement picture, string alt) { picture.Alt = alt; return(picture); }
/// <summary> /// Returns the html of picture element with sources and attributes. /// </summary> /// <param name="helper"></param> /// <param name="picture"></param> /// <returns></returns> public static IHtmlString RenderPicture(this HtmlHelper helper, IPictureElement picture) { return new HtmlString(picture.ToString()); }
public static void RenderHere(this IPictureElement picture) { HttpContext.Current.Response.Output.WriteLine(picture.ToString()); }