Uredi

Deli z drugimi prek


XamlServices Class

Definition

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.

public ref class XamlServices abstract sealed
public static class XamlServices
type XamlServices = class
Public Class XamlServices
Inheritance
XamlServices

Remarks

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.

Important

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.

Methods

Load(Stream)

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

Load(String)

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

Load(TextReader)

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

Load(XamlReader)

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

Load(XmlReader)

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

Parse(String)

Reads XAML as string output and returns an object graph.

Save(Object)

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

Save(Stream, Object)

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

Save(String, Object)

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

Save(TextWriter, Object)

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

Save(XamlWriter, Object)

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

Save(XmlWriter, Object)

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

Transform(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.

Transform(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.

Applies to