XamlServices.Save Method (Object)

.NET Framework (current version)

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Processes a provided object tree into a XAML node representation, and returns a string representation of the output XAML.

Namespace:   System.Xaml
Assembly:  System.Xaml (in System.Xaml.dll)

public static string Save(
	object instance


Type: System.Object

The root of the object graph to process.

Return Value

Type: System.String

The XAML markup output as a string.

The output from this method is the ToString result of an XmlWriter that is created by the method call. That XmlWriter is created by using the following settings: XmlWriterSettings.Indent is true; and XmlWriterSettings.OmitXmlDeclaration is true.

The returned string can be loaded as valid XML through the Create method if you processed the string into a stream, or into a reader more specifically dedicated for XAML.

.NET Framework
Available since 4.0
Return to top