コード例 #1
0
        protected override void FillXmlElement(XmlElement element, XmlDocument document)
        {
            base.FillXmlElement(element, document);
            element.SetAttribute("Name", dataNode.Name);
            element.SetAttribute("Collapsed", Collapsed.ToString());
            element.SetAttribute("Hidden", Hidden.ToString());
            if (dataNode.GetStateShowNodeCodeButton())
            {
                element.SetAttribute("ShowCode", dataNode.ShowCodeNodeButton.ToString());
            }

            //<Contents>
            if (nodeContents.Count == 0)
            {
                return;
            }

            XmlElement nodeContentDoc = document.CreateElement("Contents");

            foreach (InteractiveHeaderedItem tg in nodeContents)
            {
                XmlElement grp = document.CreateElement("Content");
                grp.SetAttribute("Line", nodeContentNames[tg]);
                grp.SetAttribute("Collapsed", tg.Collapsed.ToString());
                nodeContentDoc.AppendChild(grp);
            }
            element.AppendChild(nodeContentDoc);
        }
コード例 #2
0
        protected override void OnSerializing(SerializeEventArgs e)
        {
            if (collapsed)
            {
                collapsed = false;
                base.OnSerializing(e);
                collapsed = true;
            }
            else
            {
                base.OnSerializing(e);
            }

            XmlElement collapsedNode = e.Node.OwnerDocument.CreateElement("Collapsed");

            collapsedNode.InnerText = Collapsed.ToString();
            e.Node.AppendChild(collapsedNode);
        }
コード例 #3
0
ファイル: Taskpad.cs プロジェクト: alex-kukhtin/A2v10
        public override void RenderElement(RenderContext context, Action <TagBuilder> onRender = null)
        {
            if (SkipRender(context))
            {
                return;
            }
            var tag = new TagBuilder("a2-taskpad", null, IsInGrid);

            onRender?.Invoke(tag);
            MergeAttributes(tag, context);
            MergeBindingAttributeString(tag, context, "title", nameof(Title), Title);
            tag.AddCssClassBool(Overflow, "overflow");
            tag.MergeStyle("grid-column", Position == TaskpadPosition.Left ? "1" : "2");

            if (Background != BackgroundStyle.Default)
            {
                tag.AddCssClass("background-" + Background.ToString().ToKebabCase());
            }

            tag.AddCssClassBoolNo(Collapsible, "collapsible");

            tag.MergeAttribute("position", Position.ToString().ToLowerInvariant());
            var colBind = GetBinding(nameof(Collapsed));

            if (colBind != null)
            {
                tag.MergeAttribute(":initial-collapsed", colBind.GetPath(context));
            }
            else
            {
                tag.MergeAttribute(":initial-collapsed", Collapsed.ToString().ToLowerInvariant());
            }

            tag.RenderStart(context);
            RenderChildren(context);
            tag.RenderEnd(context);
        }