XamlWriter Class

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

Provides default implementation and base class definitions for a XAML writer. This is not a working default XAML writer; you must either derive from XamlWriter and implement its abstract members, or use an existing XamlWriter derived class.

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

public abstract class XamlWriter : IDisposable


Initializes a new instance of the XamlWriter class.


Gets whether Dispose has been called.


When implemented in a derived class, gets the active XAML schema context.


Closes the XAML writer object.


Releases the unmanaged resources used by the XamlWriter and optionally releases the managed resources.


Determines whether the specified object is equal to the current object.(Inherited from Object.)


Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.(Inherited from Object.)


Serves as the default hash function. (Inherited from Object.)


Gets the Type of the current instance.(Inherited from Object.)


Creates a shallow copy of the current Object.(Inherited from Object.)


Returns a string that represents the current object.(Inherited from Object.)


When implemented in a derived class, produces the representation of an end member node.


When implemented in a derived class, produces the representation of an end object node.


When implemented in a derived class, produces an object for cases where the object is a default or implicit value of the property being set, instead of being specified as a discrete object value in the input XAML node set.


When implemented in a derived class, writes a XAML namespace declaration node.


Performs switching based on node type from the XAML reader (XamlReader.NodeType) and calls the relevant Write method for the writer implementation.


When implemented in a derived class, writes the representation of a start member node.


When implemented in a derived class, writes the representation of a start object node.


When implemented in a derived class, writes a value node.


This API supports the product infrastructure and is not intended to be used directly from your code. See Dispose.

The two most relevant practical derived classes of XamlWriter are the XamlXmlWriter and XamlObjectWriter classes, as the following details explain:

  • XamlXmlWriter processes a XAML node set and produces an XML text file. This class might be used for serialization or as part of the function of a tool that works with in-memory representation of XAML and produces XAML file output.

  • XamlObjectWriter processes a XAML node set and produces an object graph. This class might be used as part of a full or partial customization of a technology's XAML parser.

XamlWriterSettings is a class for settings that are used by a XamlWriter; however, by default, the XamlWriterSettings class does not hold any specific settings. The XamlWriter base constructor does not use this settings class as an argument, nor does any other XamlWriter member. Instead, the XamlXmlWriter and XamlObjectWriter classes include their own settings classes as construction arguments. These settings classes are XamlXmlWriterSettings and XamlObjectWriterSettings. The settings classes define actual settings values and are based on XamlWriterSettings, so that they can use the XamlWriterSettings merge feature.

.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