public static void SetHtmlBorderBrush(this HtmlElement element, Brush borderBrush, Size targetSize, IRenderElementFactory factory, HtmlValueConverter converter) { element.ClearHtmlStyleProperty("border-color"); element.ClearHtmlStyleProperty("border-image-source"); if (borderBrush is SolidColorBrush) { element.SetHtmlStyleProperty("border-color", converter.ToColorString((SolidColorBrush)borderBrush)); } else if (borderBrush != null) { element.SetHtmlStyleProperty("border-image-source", converter.ToImageString(borderBrush, new Rect(targetSize), factory)); } }
public static void SetHtmlBackground(this HtmlElement element, Brush background, Rect targetRect, IRenderElementFactory factory, HtmlValueConverter converter) { element.ClearHtmlStyleProperty("background-color"); element.ClearHtmlStyleProperty("background-image"); if (background is SolidColorBrush) { element.SetHtmlStyleProperty("background-color", converter.ToColorString((SolidColorBrush)background)); } else if (background != null) { element.SetHtmlStyleProperty("background-image", converter.ToImageString(background, targetRect, factory)); } }
public static void SetHtmlForeground(this HtmlElement element, Brush foreground, HtmlValueConverter converter) { if (foreground == null) { element.ClearHtmlStyleProperty("color"); } else if (foreground is SolidColorBrush) { element.SetHtmlStyleProperty("color", converter.ToColorString((SolidColorBrush)foreground)); } else { throw new Granular.Exception("A \"{0}\" foreground brush is not supported", foreground.GetType()); } }