public MainWindow() { InitializeComponent(); rootElement = SUIElement.PARSE_XML("../../../example.xml"); rootElement.setStyle(new SUIStyle() { Background = Colors.LightGreen }); rootElement.setMargin(50, 50, 0, 0); rootElement.draw(mCanvas, new Point(0, 0)); }
private static SUIElement PARSE_XML_OBJECT(XmlNode inNode) { SUIElement currentElement; switch (inNode.Name) { default: case "body": case "div": currentElement = new SUIDivPanel(null); break; case "button": currentElement = new SUIButton(inNode.InnerText); break; case "label": currentElement = new SUILabel(inNode.InnerText); break; } if (inNode.Attributes != null) { if (inNode.Attributes["style"] != null) { currentElement.Style = PARSE_STYLE(inNode.Attributes["style"].Value); } } foreach (XmlNode node in inNode.ChildNodes) { SUIElement element = PARSE_XML_OBJECT(node); if (element != null) { currentElement.Children.Add(element); } } return(currentElement); }