This documentation is archived and is not being maintained.

XamlWriter Class

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

The XamlWriter type exposes the following members.

Protected methodXamlWriterInitializes a new instance of the XamlWriter class.

Protected propertyIsDisposedGets whether Dispose has been called.
Public propertySchemaContextWhen implemented in a derived class, gets the active XAML schema context.

Public methodCloseCloses the XAML writer object.
Protected methodDisposeReleases the unmanaged resources used by the XamlWriter and optionally releases the managed resources.
Public methodEquals(Object)Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public methodGetHashCodeServes as a hash function for a particular type. (Inherited from Object.)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Protected methodMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)
Public methodWriteEndMemberWhen implemented in a derived class, produces the representation of an end member node.
Public methodWriteEndObjectWhen implemented in a derived class, produces the representation of an end object node.
Public methodWriteGetObjectWhen 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.
Public methodWriteNamespaceWhen implemented in a derived class, writes a XAML namespace declaration node.
Public methodWriteNodePerforms switching based on node type from the XAML reader (XamlReader.NodeType) and calls the relevant Write method for the writer implementation.
Public methodWriteStartMemberWhen implemented in a derived class, writes the representation of a start member node.
Public methodWriteStartObjectWhen implemented in a derived class, writes the representation of a start object node.
Public methodWriteValueWhen implemented in a derived class, writes a value node.

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

Supported in: 4

.NET Framework Client Profile

Supported in: 4

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

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