コード例 #1
0
 /// <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);
 }
コード例 #2
0
 public static MvcHtmlString RenderPicture(this HtmlHelper helper, IPictureElement picture)
 {
     return(new MvcHtmlString(picture.ToString()));
 }
コード例 #3
0
 /// <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);
 }
コード例 #4
0
 /// <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);
 }
コード例 #5
0
 /// <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);
 }
コード例 #6
0
 /// <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);
 }
コード例 #7
0
 /// <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()));
 }
コード例 #8
0
 /// <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);
 }
コード例 #9
0
 /// <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());
 }
コード例 #10
0
 public static void RenderHere(this IPictureElement picture)
 {
     HttpContext.Current.Response.Output.WriteLine(picture.ToString());
 }