Version

SaveAsXml(String) Method

Saves UltraTree data into the specified file in XML (Soap) format.
Syntax
'Declaration
 
Public Overloads Sub SaveAsXml( _
   ByVal filename As String _
) 
public void SaveAsXml( 
   string filename
)

Parameters

filename
The name of the file to write.
Example
The following sample code shows how to save and load the state of the tree.

Imports Infragistics.Win
Imports Infragistics.Win.UltraWinTree

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click

    ' The following code will save the state of the tree
    ' into a file in XML format
    Me.ultraTree1.SaveAsXml("tree.xml")

    ' The following code will save the state of the tree
    ' into a file in binary format
    Me.ultraTree1.SaveAsBinary("tree.dat")

    Dim stream As New System.IO.MemoryStream()

    ' The following code will save the state of the tree
    ' into a stream (in Me case a memory stream) in binary format
    Me.ultraTree1.SaveAsBinary(stream)

    ' Note: Before calling the LoadFromBinary on the memory
    '       stream created above, we need to reset its position
    '       back to 0.
    stream.Position = 0

    ' The following code will re-load the state of the tree
    ' from the memory stream.
    Me.ultraTree1.LoadFromBinary(stream)

    ' Note: The SaveAsXml and LoadFromXml methods also have
    '       overloads that take a stream.

End Sub

Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click

    ' The following code will load the state of the tree
    ' from a previously saved XML format file. 
    Me.ultraTree1.LoadFromXml("tree.xml")

    ' The following code will load the state of the tree
    ' from a previously saved binary format file. 
    Me.ultraTree1.LoadFromBinary("tree.dat")

End Sub
using System.Diagnostics;
using Infragistics.Win;
using Infragistics.Win.UltraWinTree;

private void button3_Click(object sender, System.EventArgs e)
{
	// The following code will save the state of the tree
	// into a file in XML format
	this.ultraTree1.SaveAsXml( "tree.xml" );
		
	// The following code will save the state of the tree
	// into a file in binary format
	this.ultraTree1.SaveAsBinary( "tree.dat" );
		
	System.IO.MemoryStream stream = new System.IO.MemoryStream();

	// The following code will save the state of the tree
	// into a stream (in this case a memory stream) in binary format
	this.ultraTree1.SaveAsBinary( stream );

	// Note: Before calling the LoadFromBinary on the memory
	//       stream created above, we need to reset its position
	//       back to 0.
	stream.Position = 0;
		
	// The following code will re-load the state of the tree
	// from the memory stream.
	this.ultraTree1.LoadFromBinary( stream );

	// Note: The SaveAsXml and LoadFromXml methods also have
	//       overloads that take a stream.
}

private void button4_Click(object sender, System.EventArgs e)
{
	// The following code will load the state of the tree
	// from a previously saved XML format file. 
	this.ultraTree1.LoadFromXml( "tree.xml" );
		
	// The following code will load the state of the tree
	// from a previously saved binary format file. 
	this.ultraTree1.LoadFromBinary( "tree.dat" );
		
}
Requirements

Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also