Ejemplo n.º 1
0
        public void ApplyStyle(IModelLayoutStyle layoutStyle, WebControl webControl)
        {
            ApplyColors(layoutStyle, webControl);

            var fontStyle = GetValue <FontStyle>(layoutStyle, _fontStylePropertyName);

            if (fontStyle != FontStyle.Regular)
            {
                webControl.Style.Add(HtmlTextWriterStyle.FontStyle, fontStyle.ToString());
            }

            ApplyCssClassAndInlineStyle(layoutStyle, webControl);
        }
Ejemplo n.º 2
0
        void ApplyColors(IModelLayoutStyle layoutStyle, WebControl webControl)
        {
            var color = GetValue <Color>(layoutStyle, _backColorPropertyName);

            if (color != Color.Empty)
            {
                webControl.Style.Add(HtmlTextWriterStyle.BackgroundColor, ColorTranslator.ToHtml(color));
            }

            color = GetValue <Color>(layoutStyle, _fontColorPropertyName);
            if (color != Color.Empty)
            {
                webControl.Style.Add(HtmlTextWriterStyle.Color, ColorTranslator.ToHtml(color));
            }
        }
Ejemplo n.º 3
0
        void ApplyCssClassAndInlineStyle(IModelLayoutStyle layoutStyle, WebControl webControl)
        {
            var value = GetValue <string>(layoutStyle, _cssClassPropertyName);

            if (!string.IsNullOrEmpty(value))
            {
                webControl.CssClass = value;
            }

            value = GetValue <string>(layoutStyle, _stylePropertyName);
            if (!string.IsNullOrEmpty(value))
            {
                webControl.Style.Value += ";" + value;
            }
        }
Ejemplo n.º 4
0
        T GetValue <T>(IModelLayoutStyle modelLayoutStyle, string name)
        {
            var value = modelLayoutStyle.GetValue <T>(name);

            return(!IsDefault(value) ? value : default);