public static void SetHtmlOpacity(this HtmlElement element, double opacity, HtmlValueConverter converter) { if (opacity == 1.0) { element.ClearHtmlStyleProperty("opacity"); } else { element.SetHtmlStyleProperty("opacity", converter.ToImplicitValueString(opacity)); } }
public static void SetHtmlBorderThickness(this HtmlElement element, Thickness borderThickness, HtmlValueConverter converter) { if (borderThickness == Thickness.Zero) { element.ClearHtmlStyleProperty("border-style"); element.ClearHtmlStyleProperty("border-width"); element.ClearHtmlStyleProperty("border-image-slice"); } else { element.SetHtmlStyleProperty("border-style", "solid"); element.SetHtmlStyleProperty("border-width", converter.ToPixelString(borderThickness)); element.SetHtmlStyleProperty("border-image-slice", converter.ToImplicitValueString(borderThickness)); } }