internal void MergeDisabled(TagBuilder tag, String disabledVal) { var existingDisabled = tag.GetAttribute(":disabled"); if (!String.IsNullOrEmpty(existingDisabled)) { disabledVal = $"{existingDisabled} || {disabledVal}"; } tag.MergeAttribute(":disabled", disabledVal, replaceExisting: true); }
public override void RenderElement(RenderContext context, Action <TagBuilder> onRender = null) { if (SkipRender(context)) { return; } var list = new TagBuilder("div", "image-list"); var isBind = GetBinding(nameof(ItemsSource)); if (isBind == null) { throw new XamlException("ItemsSource binding is required for the ImageList element"); } MergeAttributes(list, context); String source = isBind.GetPath(context); list.RenderStart(context); TagBuilder itemTag = null; if (ItemTemplate != null) { using (new ScopeContext(context, "img")) { ItemTemplate.RenderElement(context, (tag) => { tag.MergeAttribute("v-for", $"(img, imgIndex) in {source}"); tag.MergeAttribute(":in-array", "true"); tag.MergeAttribute(":key", "imgIndex"); itemTag = tag; }); } /* new element */ var ni = new TagBuilder("a2-image"); ni.MergeAttribute(":new-item", "true"); ni.MergeAttribute(":source", source); ni.MergeAttribute("base", itemTag.GetAttribute("base")); ni.MergeAttribute("prop", itemTag.GetAttribute("prop")); ni.Render(context); } list.RenderEnd(context); }
public override void RenderElement(RenderContext context, Action <TagBuilder> onRender = null) { if (SkipRender(context)) { return; } var tr = new TagBuilder("tr"); onRender?.Invoke(tr); MergeAttributes(tr, 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"); } var class2 = tr.GetAttribute(":class"); if (!String.IsNullOrEmpty(class2)) { tr.MergeAttribute(":class", $"row.rowCssClass({markBind.GetPathFormat(context)})", replaceExisting: true); } else { tr.MergeAttribute(":class", markBind.GetPathFormat(context)); } } else if (Mark != MarkStyle.Default) { tr.AddCssClass(Mark.ToString().ToKebabCase()); } if (Style != RowStyle.Default) { tr.AddCssClass("row-" + Style.ToString().ToKebabCase()); } if (Align != null) { tr.AddCssClass("text-" + Align.ToString().ToLowerInvariant()); } tr.RenderStart(context); foreach (var c in Cells) { c.RenderElement(context); } tr.RenderEnd(context); }