예제 #1
0
파일: XmlDisplay.cs 프로젝트: rdterner/fcmd
        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) });
        }
예제 #2
0
 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);
 }
예제 #3
0
		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"));
		}