XamlServices Class

.NET Framework (current version)
 

Provides higher-level services (static methods) for the common XAML tasks of reading XAML and writing an object graph; or reading an object graph and writing XAML file output for serialization purposes.

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

System.Object
  System.Xaml.XamlServices

public static class XamlServices

NameDescription
System_CAPS_pubmethodSystem_CAPS_staticLoad(Stream)

Loads a Stream source for a XAML reader and writes its output as an object graph.

System_CAPS_pubmethodSystem_CAPS_staticLoad(String)

Loads a Stream source for a XAML reader and returns an object graph.

System_CAPS_pubmethodSystem_CAPS_staticLoad(TextReader)

Creates a XAML reader from a TextReader, and returns an object graph.

System_CAPS_pubmethodSystem_CAPS_staticLoad(XamlReader)

Loads a specific XAML reader implementation and returns an object graph.

System_CAPS_pubmethodSystem_CAPS_staticLoad(XmlReader)

Loads a specific XML reader implementation and returns an object graph.

System_CAPS_pubmethodSystem_CAPS_staticParse(String)

Reads XAML as string output and returns an object graph.

System_CAPS_pubmethodSystem_CAPS_staticSave(Object)

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

System_CAPS_pubmethodSystem_CAPS_staticSave(Stream, Object)

Processes a provided object graph into a XAML node representation and then into an output stream for serialization.

System_CAPS_pubmethodSystem_CAPS_staticSave(String, Object)

Processes a provided object graph into a XAML node representation and then writes it to an output file at a provided location.

System_CAPS_pubmethodSystem_CAPS_staticSave(TextWriter, Object)

Processes a provided object graph into a XAML node representation and then into an output that goes to the provided TextWriter.

System_CAPS_pubmethodSystem_CAPS_staticSave(XamlWriter, Object)

Processes a provided object graph into a XAML node representation and then writes it to the provided XAML writer.

System_CAPS_pubmethodSystem_CAPS_staticSave(XmlWriter, Object)

Processes a provided object graph into a XAML node representation and then writes it to the provided XmlWriter.

System_CAPS_pubmethodSystem_CAPS_staticTransform(XamlReader, XamlWriter)

Connects a XamlReader and a XamlWriter to use a common XAML node set intermediary. Potentially transforms the content, depending on the types of readers and writers that are provided.

System_CAPS_pubmethodSystem_CAPS_staticTransform(XamlReader, XamlWriter, Boolean)

Connects a XamlReader and a XamlWriter to use a common XAML node set intermediary. Potentially transforms the content, depending on the types of readers and writers that are provided. Provides a parameter for specifying whether to close the writer after the call is completed.

The modes of the XamlServices class that are used in the most common XAML reading and writing scenarios rely on creating instances of XAML readers and XAML writers. These readers and writers are specialized but internal implementations of public classes, such as XmlReader, XamlXmlReader, and XamlObjectWriter. To use XamlServices for most scenarios, you can rely on the default internal implementations to obtain the results that you want. For more specialized scenarios, you might define readers and writers yourself, and then pass them as arguments for overloads of the XamlServices methods.

System_CAPS_importantImportant

XamlServices is not the recommended XAML reading or XAML writing API set if you are processing WPF-defined types, or types based on WPF. For WPF usage, use System.Windows.Markup.XamlReader for reading or loading XAML (or BAML); and System.Windows.Markup.XamlWriter for writing back XAML. These classes use .NET Framework XAML Services APIs and the XAML readers and XAML writers internally in their implementation; however, they also provide support and specialized XAML schema context for WPF-specific concepts, such as optimizations for dependency properties and WPF known types.

.NET Framework
Available since 4.0

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Return to top
Show: