Private Sub btnSave_Click(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles btnSave.Click Me.UltraTree1.SaveAsXml("UWTree1.xml") End Sub
Introduced in v3 of the WinTree™ is the ability to save and load control layouts. The information stored by the layout includes everything that affects the appearance of the tree: The Nodes collection, the Override object and sub-objects, and all related properties.
Tree layouts may be saved in either binary or XML format. The binary format is more space-efficient, while the XML format provides greater inter-operability with other technologies. You can choose to serialize the layout to a storage stream or write it into a file on disk. When you load a layout file into the Tree, you should use the method that corresponds to the method used to save the file. If you use the SaveAsBinary method to create the layout file, you should use the LoadFromBinary method to load that file and restore the saved layout. Similarly, files created with the SaveAsXml method should be restored with the LoadFromXml method.
Use the following code to write the Tree layout in Xml format into a local file in a specific location.
In Visual Basic:
Private Sub btnSave_Click(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles btnSave.Click Me.UltraTree1.SaveAsXml("UWTree1.xml") End Sub
In C#:
private void btnSave_Click(object sender, EventArgs e) { this.ultraTree1.SaveAsXml("UWTree1.xml"); }
Use the following code to load the previously saved file back into the Tree.
In Visual Basic:
Private Sub btnLoad_Click(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles btnLoad.Click Me.UltraTree1.LoadFromXml("UWTree1.xml") End Sub
In C#:
private void btnLoad_Click(object sender, EventArgs e) { this.ultraTree1.LoadFromXml("UWTree1.xml"); }