Пример #1
0
        }                                                // ???

        internal override void RenderElement(RenderContext context, Action <TagBuilder> onRender = null)
        {
            if (SkipRender(context))
            {
                return;
            }
            var td = new TagBuilder("td");

            MergeAttributes(td, context);
            td.MergeAttribute("colspan", ColSpan);
            td.MergeAttribute("rowspan", RowSpan);
            if (Align != null)
            {
                td.AddCssClass("text-" + Align.ToString().ToLowerInvariant());
            }
            if (VAlign != VerticalAlign.Default)
            {
                td.AddCssClass($"valign-{VAlign.ToString().ToLowerInvariant()}");
            }
            if (GroupIndent && IsInTreeSection)
            {
                td.MergeAttribute(":class", "row.indentCssClass()");
            }
            if (Underline)
            {
                td.AddCssClass("underline");
            }
            MergeContent(td, context);
            td.AddCssClassBoolNo(Bold, "bold");
            td.AddCssClassBoolNo(Italic, "italic");
            td.RenderStart(context);
            RenderContent(context);
            td.RenderEnd(context);
        }
Пример #2
0
 public Legend(Layout _layout, HAlign _hAlign, VAlign _vAlign, int _borderwidth)
 {
     borderWidth = _borderwidth;
     layout      = _layout.ToString();
     hAlign      = _hAlign.ToString();
     vAlign      = _vAlign.ToString();
 }
Пример #3
0
        public static XLAlignVertEnum ToXLAlignV(this VAlign align)
        {
            XLAlignVertEnum result;

            if (Enum.TryParse(align.ToString(), out result))
            {
                return(result);
            }
            else
            {
                return(XLAlignVertEnum.Undefined);
            }
        }
Пример #4
0
        public override void GenerateXmlAttributes(XmlWriter writer)
        {
            base.GenerateXmlAttributes(writer);

            if (Label.IsNotWhiteSpace())
            {
                writer.WriteAttributeString("label", Label);
            }
            if (Align.HasValue)
            {
                writer.WriteAttributeString("Align", Align.ToString());
            }
            if (VAlign.HasValue)
            {
                writer.WriteAttributeString("VAlign", VAlign.ToString());
            }

            if (_fontAttr != null)
            {
                _fontAttr.GenerateXmlAttributes(writer);
            }

            if (LetterSpacing.HasValue)
            {
                writer.WriteAttributeString("LetterSpacing", LetterSpacing.ToString());
            }
            if (LeftMargin.HasValue)
            {
                writer.WriteAttributeString("LeftMargin", LeftMargin.ToString());
            }
            if (BgColor.HasValue)
            {
                writer.WriteAttributeString("BgColor", BgColor.Value.ToHexString());
            }
            if (BorderColor.HasValue)
            {
                writer.WriteAttributeString("BorderColor", BorderColor.Value.ToHexString());
            }
            if (Wrap.HasValue)
            {
                writer.WriteAttributeString("Wrap", Wrap.GetHashCode().ToString());
            }
            if (WrapWidth.HasValue)
            {
                writer.WriteAttributeString("WrapWidth", WrapWidth.ToString());
            }
            if (WrapHeight.HasValue)
            {
                writer.WriteAttributeString("WrapHeight", WrapHeight.ToString());
            }
        }
Пример #5
0
        internal override void RenderElement(RenderContext context, Action <TagBuilder> onRender = null)
        {
            if (SkipRender(context))
            {
                return;
            }
            var row = new TagBuilder("tr");

            onRender?.Invoke(row);
            MergeAttributes(row, context);

            var markBind = GetBinding(nameof(Mark));

            if (markBind != null)
            {
                if (GetBinding(nameof(Bold)) != null)
                {
                    throw new XamlException("The Bold and Mark bindings cannot be used at the same time");
                }
                row.MergeAttribute(":class", markBind.GetPathFormat(context));
            }
            else if (Mark != MarkStyle.Default)
            {
                row.AddCssClass(Mark.ToString().ToKebabCase());
            }

            if (Align != TextAlign.Left)
            {
                row.AddCssClass("text-" + Align.ToString().ToLowerInvariant());
            }

            if (VAlign != VerticalAlign.Default)
            {
                row.AddCssClass($"valign-{VAlign.ToString().ToLowerInvariant()}");
            }

            row.RenderStart(context);
            RenderCells(context);
            row.RenderEnd(context);
        }
Пример #6
0
        }                                                // ???

        public override void RenderElement(RenderContext context, Action <TagBuilder> onRender = null)
        {
            if (SkipRender(context))
            {
                return;
            }
            var td = new TagBuilder("td");

            MergeAttributes(td, context);

            var colSpanBind = GetBinding(nameof(ColSpan));

            if (colSpanBind != null)
            {
                td.MergeAttribute(":colspan", colSpanBind.GetPath(context));
            }
            else
            {
                td.MergeAttribute("colspan", ColSpan);
            }
            var rowSpanBind = GetBinding(nameof(RowSpan));

            if (rowSpanBind != null)
            {
                td.MergeAttribute(":rowspan", rowSpanBind.GetPath(context));
            }
            else
            {
                td.MergeAttribute("rowspan", RowSpan);
            }

            if (Align != null)
            {
                td.AddCssClass("text-" + Align.ToString().ToLowerInvariant());
            }
            if (VAlign != VerticalAlign.Default)
            {
                td.AddCssClass($"valign-{VAlign.ToString().ToLowerInvariant()}");
            }
            if (GroupIndent && IsInTreeSection)
            {
                td.MergeAttribute(":class", "row.indentCssClass()");
            }
            if (Underline)
            {
                td.AddCssClass("underline");
            }
            td.AddCssClassBoolNo(Bold, "bold");
            td.AddCssClassBoolNo(Italic, "italic");
            if (Vertical)
            {
                td.AddCssClass("vert");
                td.RenderStart(context);
                var div = new TagBuilder("p", "vcell");
                MergeContent(div, context);
                div.RenderStart(context);
                RenderContentVert(context, Content);
                div.RenderEnd(context);
                td.RenderEnd(context);
            }
            else
            {
                MergeContent(td, context);
                td.RenderStart(context);
                RenderContent(context);
                td.RenderEnd(context);
            }
        }
Пример #7
0
        internal override void RenderElement(RenderContext context, Action <TagBuilder> onRender = null)
        {
            if (SkipRender(context))
            {
                return;
            }
            var td = new TagBuilder("td");

            onRender?.Invoke(td);

            MergeAttributes(td, context);

            var boldBind   = GetBinding(nameof(Bold));
            var italicBind = GetBinding(nameof(Italic));

            if (boldBind != null || italicBind != null)
            {
                var sb = new StringBuilder("{");
                if (boldBind != null)
                {
                    sb.Append($"bold: {boldBind.GetPath(context)}, ");
                }
                if (italicBind != null)
                {
                    sb.Append($"italic: {italicBind.GetPath(context)}, ");
                }
                sb.RemoveTailComma();
                sb.Append("}");
                td.MergeAttribute(":class", sb.ToString());
            }
            td.AddCssClassBoolNo(Bold, "bold");
            td.AddCssClassBoolNo(Italic, "italic");
            td.AddCssClassBool(Gray, "gray");

            MergeContent(td, context);

            if (Align != TextAlign.Left)
            {
                td.AddCssClass("text-" + Align.ToString().ToLowerInvariant());
            }

            if (VAlign != VerticalAlign.Default)
            {
                td.AddCssClass($"valign-{VAlign.ToString().ToLowerInvariant()}");
            }

            if (Content is ITableControl)
            {
                td.AddCssClass("ctrl");
            }

            Bind isBind = GetBinding(nameof(ItemsSource));

            if (isBind != null)
            {
                td.MergeAttribute("v-for", $"(cell, cellIndex) in {isBind.GetPath(context)}");
                td.MergeAttribute(":key", "cellIndex");
            }
            MergeAttributeInt32(td, context, nameof(ColSpan), "colspan", ColSpan);
            MergeAttributeInt32(td, context, nameof(RowSpan), "rowspan", RowSpan);
            td.RenderStart(context);
            RenderContent(context);

            /*
             * Никакого толку, содержимое в атрибуте
             * if (Validate)
             * {
             * var val = new TagBuilder("validator-control");
             * val.MergeAttribute(":item", "row");
             * val.MergeAttribute("prop", "Sum");
             * val.Render(context);
             * }*/
            td.RenderEnd(context);
        }
Пример #8
0
        void RenderCell(TagBuilder td, RenderContext context)
        {
            MergeAttributes(td, context);

            var boldBind   = GetBinding(nameof(Bold));
            var italicBind = GetBinding(nameof(Italic));

            if (boldBind != null || italicBind != null)
            {
                var sb = new StringBuilder("{");
                if (boldBind != null)
                {
                    sb.Append($"bold: {boldBind.GetPath(context)}, ");
                }
                if (italicBind != null)
                {
                    sb.Append($"italic: {italicBind.GetPath(context)}, ");
                }
                sb.RemoveTailComma();
                sb.Append("}");
                td.MergeAttribute(":class", sb.ToString());
            }
            td.AddCssClassBoolNo(Bold, "bold");
            td.AddCssClassBoolNo(Italic, "italic");
            td.AddCssClassBool(Gray, "gray");


            if (Align != TextAlign.Left)
            {
                td.AddCssClass("text-" + Align.ToString().ToLowerInvariant());
            }

            if (VAlign != VerticalAlign.Default)
            {
                td.AddCssClass($"valign-{VAlign.ToString().ToLowerInvariant()}");
            }

            if (Content is ITableControl)
            {
                td.AddCssClass("ctrl");
            }

            MergeContent(td, context);

            var colSpanBind = GetBinding(nameof(ColSpan));

            if (colSpanBind != null)
            {
                td.MergeAttribute(":colspan", colSpanBind.GetPath(context));
            }
            else
            {
                MergeAttributeInt32(td, context, nameof(ColSpan), "colspan", ColSpan);
            }
            var rowSpanBind = GetBinding(nameof(RowSpan));

            if (rowSpanBind != null)
            {
                td.MergeAttribute(":rowspan", rowSpanBind.GetPath(context));
            }
            else
            {
                MergeAttributeInt32(td, context, nameof(RowSpan), "rowspan", RowSpan);
            }

            td.RenderStart(context);
            RenderContent(context);

            /*
             * no use, the content in the attribute
             * if (Validate)
             * {
             * var val = new TagBuilder("validator-control");
             * val.MergeAttribute(":item", "row");
             * val.MergeAttribute("prop", "Sum");
             * val.Render(context);
             * }*/
            td.RenderEnd(context);
        }
Пример #9
0
 public Legend(Layout _layout, HAlign _hAlign, VAlign _vAlign, int _borderwidth)
 {
     borderWidth = _borderwidth;
     layout = _layout.ToString();
     hAlign = _hAlign.ToString();
     vAlign = _vAlign.ToString();
 }