public XmlDisplay(XmlNode node, System.Collections.Hashtable ht = null) { this.CanGetFocus = true; this.node = node; if (ht != null) ht.Add(node, this); //register self in the common registry of conformity between XmlNode <--> XmlDisplay Xwt.Expander exp = new Expander { Expanded = true, Label = node.Name, Font = Font.WithWeight(Xwt.Drawing.FontWeight.Semibold) }; exp.Content = layout; layout.Font = Font.WithWeight(Xwt.Drawing.FontWeight.Normal); //для уверенности this.Content = exp; if (node.Attributes != null) foreach (XmlAttribute a in node.Attributes) { layout.PackStart(new Label(a.LocalName + " = " + a.Value) { Tag = a, Font = Font.WithWeight(Xwt.Drawing.FontWeight.Normal) } ); } if (node.ChildNodes != null) if (node.ChildNodes.Count > 0) foreach (XmlNode n in node.ChildNodes) { XmlDisplay child_xd = new XmlDisplay(n, ht) { Tag = n, MarginLeft=24 }; layout.PackStart(child_xd); //обеспечивается рекурсивность } else layout.PackStart(new Label(node.InnerText) { Tag = node, Font = Font.WithWeight(Xwt.Drawing.FontWeight.Normal) }); }
public ExpanderSample() { expander = new Expander (); expander.Label = "A title here"; var content = new VBox (); content.PackStart (new Label () { Text = "Label 1" }); content.PackStart (new Button () { Label = "Button 2" }); expander.Content = content; PackStart (expander); }
public ExpanderSample () { expander = new Expander (); expander.Label = "A title here"; var content = new VBox (); content.PackStart (new Label () { Text = "Label 1" }); content.PackStart (new Button () { Label = "Button 2" }); content.BackgroundColor = Colors.Gray; expander.Content = content; PackStart (expander); PackStart (new Label ("This is shown below the expander")); }