예제 #1
0
        protected override void FillStyleAttributes(CssStyleCollection attributes, IUrlResolutionService urlResolver)
        {
            base.FillStyleAttributes(attributes, urlResolver);

            if (PaddingTop != Unit.Empty)
            {
                attributes.Add(HtmlTextWriterStyle.PaddingTop, PaddingTop.ToString());
            }
            if (PaddingLeft != Unit.Empty)
            {
                attributes.Add(HtmlTextWriterStyle.PaddingLeft, PaddingLeft.ToString());
            }
            if (PaddingRight != Unit.Empty)
            {
                attributes.Add(HtmlTextWriterStyle.PaddingRight, PaddingRight.ToString());
            }
            if (PaddingBottom != Unit.Empty)
            {
                attributes.Add(HtmlTextWriterStyle.PaddingBottom, PaddingBottom.ToString());
            }

            if (MarginTop != Unit.Empty)
            {
                attributes.Add(HtmlTextWriterStyle.MarginTop, MarginTop.ToString());
            }
            if (MarginLeft != Unit.Empty)
            {
                attributes.Add(HtmlTextWriterStyle.MarginLeft, MarginLeft.ToString());
            }
            if (MarginRight != Unit.Empty)
            {
                attributes.Add(HtmlTextWriterStyle.MarginRight, MarginRight.ToString());
            }
            if (MarginBottom != Unit.Empty)
            {
                attributes.Add(HtmlTextWriterStyle.MarginBottom, MarginBottom.ToString());
            }

            if (!String.IsNullOrEmpty(BackImageUrl))
            {
                attributes.Add(HtmlTextWriterStyle.BackgroundImage, String.Format("url({0})", urlResolver.ResolveClientUrl(BackImageUrl)));
            }
        }
예제 #2
0
        protected override void FillStyleAttributes(CssStyleCollection attributes, IUrlResolutionService urlResolver)
        {
            base.FillStyleAttributes(attributes, urlResolver);

            if (PaddingTop != Unit.Empty)
            {
                attributes.Add(HtmlTextWriterStyle.PaddingTop, PaddingTop.ToString());
            }
            if (PaddingLeft != Unit.Empty)
            {
                attributes.Add(HtmlTextWriterStyle.PaddingLeft, PaddingLeft.ToString());
            }
            if (PaddingRight != Unit.Empty)
            {
                attributes.Add(HtmlTextWriterStyle.PaddingRight, PaddingRight.ToString());
            }
            if (PaddingBottom != Unit.Empty)
            {
                attributes.Add(HtmlTextWriterStyle.PaddingBottom, PaddingBottom.ToString());
            }

            if (MarginTop != Unit.Empty)
            {
                attributes.Add(HtmlTextWriterStyle.MarginTop, MarginTop.ToString());
            }
            if (MarginLeft != Unit.Empty)
            {
                attributes.Add(HtmlTextWriterStyle.MarginLeft, MarginLeft.ToString());
            }
            if (MarginRight != Unit.Empty)
            {
                attributes.Add(HtmlTextWriterStyle.MarginRight, MarginRight.ToString());
            }
            if (MarginBottom != Unit.Empty)
            {
                attributes.Add(HtmlTextWriterStyle.MarginBottom, MarginBottom.ToString());
            }
        }
예제 #3
0
        protected override void RenderAttributes(XElement element, FoRenderOptions options)
        {
            if (Src.IsNullOrWhiteSpace())
            {
                throw new PropertyNotSetException(nameof(Src));
            }
            element.Add(new XAttribute("src", Src));

            if (Width.HasValue())
            {
                element.Add(new XAttribute("width", Width));
            }
            if (Height.HasValue())
            {
                element.Add(new XAttribute("height", Height));
            }
            if (ContentWidth.HasValue())
            {
                element.Add(new XAttribute("content-width", ContentWidth));
            }
            if (ContentHeight.HasValue())
            {
                element.Add(new XAttribute("content-height", ContentHeight));
            }
            if (Scaling != FoScaling.Unspecified)
            {
                element.Add(new XAttribute("scaling", ToKebabCase(Scaling)));
            }
            if (ScalingMethod != FoScalingMethod.Unspecified)
            {
                element.Add(new XAttribute("scaling-method", ToKebabCase(ScalingMethod)));
            }

            if (Margin.HasValue())
            {
                element.Add(new XAttribute("margin", Margin));
            }
            if (MarginTop.HasValue())
            {
                element.Add(new XAttribute("margin-top", MarginTop));
            }
            if (MarginRight.HasValue())
            {
                element.Add(new XAttribute("margin-right", MarginRight));
            }
            if (MarginBottom.HasValue())
            {
                element.Add(new XAttribute("margin-bottom", MarginBottom));
            }
            if (MarginLeft.HasValue())
            {
                element.Add(new XAttribute("margin-left", MarginLeft));
            }

            if (Padding.HasValue())
            {
                element.Add(new XAttribute("padding", Padding));
            }
            if (PaddingTop.HasValue())
            {
                element.Add(new XAttribute("padding-top", PaddingTop));
            }
            if (PaddingRight.HasValue())
            {
                element.Add(new XAttribute("padding-right", PaddingRight));
            }
            if (PaddingBottom.HasValue())
            {
                element.Add(new XAttribute("padding-bottom", PaddingBottom));
            }
            if (PaddingLeft.HasValue())
            {
                element.Add(new XAttribute("padding-left", PaddingLeft));
            }

            base.RenderAttributes(element, options);
        }