public MainPage() { InitializeComponent(); XDocument xdoc = XDocument.Load("resources/result.xml"); root = new HTXMLNode(xdoc.Element("xbrldata")); hypertree = new HyperTree(root); //TODO:是否使用静态方法? Graphic graphic = new Graphic(); //graphic.Canvas = this.LayoutRoot; SilverlightHTView view = hypertree.GetSLView(); graphic.Canvas = view.LayoutRoot; view.graphic = graphic; view.Repaint(); this.Width = 500; this.Height = 500; this.LayoutRoot.Children.Add(view); }