XamlServices.Save Method (Stream, Object)
Processes a provided object graph into a XAML node representation and then into an output stream for serialization.
Assembly: System.Xaml (in System.Xaml.dll)
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.