XamlServices.Save Method (Object)
Processes a provided object tree into a XAML node representation, and returns a string representation of the output XAML.
Assembly: System.Xaml (in System.Xaml.dll)
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.
Available since 4.0