Exemple #1
0
        public override string ToString()
        {
            var sb = new StringBuilder();

            sb.Append(Bold.ToString());
            sb.Append("-");
            sb.Append(Italic.ToString());
            sb.Append("-");
            sb.Append(Underline.ToString());
            sb.Append("-");
            sb.Append(Strikethrough.ToString());
            sb.Append("-");
            sb.Append(VerticalAlignment.ToString());
            sb.Append("-");
            sb.Append(Shadow.ToString());
            sb.Append("-");
            sb.Append(FontSize.ToString());
            sb.Append("-");
            sb.Append(FontColor);
            sb.Append("-");
            sb.Append(FontName);
            sb.Append("-");
            sb.Append(FontFamilyNumbering.ToString());
            return(sb.ToString());
        }
Exemple #2
0
 public override string ToString()
 {
     return($"{FontName} {FontSize}pt {FontColor} " +
            (Bold ? "Bold" : "") + (Italic ? "Italic" : "") + (Strikethrough ? "Strikethrough" : "") +
            (Underline == XLFontUnderlineValues.None ? "" : Underline.ToString()) +
            $"{FontFamilyNumbering} {FontCharSet}");
 }
Exemple #3
0
        public override void RenderElement(RenderContext context, Action <TagBuilder> onRender = null)
        {
            if (SkipRender(context))
            {
                return;
            }
            var po = new TagBuilder("popover", "a2-inline", IsInGrid);

            onRender?.Invoke(po);
            MergeAttributes(po, context, MergeAttrMode.All);
            po.AddCssClass("po-" + Placement.ToString().ToKebabCase());
            if (Background != PopoverBackgroundStyle.Default)
            {
                po.AddCssClass("po-" + Background.ToString().ToKebabCase());
            }
            if (Icon != Icon.NoIcon)
            {
                po.MergeAttribute("icon", Icon.ToString().ToKebabCase());
            }
            MergeBindingAttributeString(po, context, "content", nameof(Text), Text);
            if (Underline != PopoverUnderlineMode.Enable)
            {
                po.AddCssClass("underline-" + Underline.ToString().ToLowerInvariant());
            }

            var urlBind = GetBinding(nameof(Url));

            if (ShowOnHover)
            {
                po.MergeAttribute(":hover", "true");
                if (urlBind != null || !String.IsNullOrEmpty(Url))
                {
                    throw new XamlException("'ShowOnHover' and 'Url' are not compatible.");
                }
            }

            if (urlBind != null)
            {
                po.MergeAttribute(":url", urlBind.GetPathFormat(context));
            }
            else if (!String.IsNullOrEmpty(Url))
            {
                po.MergeAttribute("url", Url);
            }

            if (Width != null)
            {
                po.MergeAttribute("width", Width.Value);
            }

            if (Top != null)
            {
                po.MergeAttribute("top", Top.Value);
            }

            po.RenderStart(context);
            var cntBind = GetBinding(nameof(Content));

            if (cntBind != null)
            {
                var cont = new TagBuilder("span");
                cont.MergeAttribute("v-text", cntBind.GetPathFormat(context));
                cont.Render(context);
            }
            else if (Content is UIElementBase)
            {
                (Content as UIElementBase).RenderElement(context);
            }
            else if (Content != null)
            {
                context.Writer.Write(context.LocalizeCheckApostrophe(Content.ToString()));
            }
            RenderPopoverBadge(context);
            po.RenderEnd(context);
        }
        public static string ToDescriptionString(this Underline val)
        {
            var attributes = (DescriptionAttribute[])val.GetType().GetField(val.ToString()).GetCustomAttributes(typeof(DescriptionAttribute), false);

            return(attributes.Length > 0 ? attributes[0].Description : string.Empty);
        }