XamlServices.Save Method (Stream, 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 graph into a XAML node representation and then into an output stream for serialization.

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

public static void Save(
	Stream stream,
	object instance


Type: System.IO.Stream

The destination stream.

Type: System.Object

The root of the object graph to process.

Exception Condition

stream input is null.


XamlServices is not the recommended XAML reading or XAML writing API set if you are processing Windows Presentation Foundation (WPF) types, or types based on WPF. For WPF usage, use System.Windows.Markup.XamlReader for reading or loading XAML; and System.Windows.Markup.XamlWriter for writing back XAML. These classes use System.Xaml APIs internally in their implementation; however, they also provide support for WPF-specific concepts that influence the nature of XAML reading and writing, such as optimizations for dependency properties.

.NET Framework
Available since 4.0
Return to top