New to Telerik UI for WPFStart a free 30-day trial

Provides functionality for serializing and deserializing XAML documents.

Definition

Namespace:Telerik.Windows.Documents.Xaml

Assembly:Telerik.Windows.Controls.RichTextBox.dll

Syntax:

C#
public class XamlSerializer

Inheritance: objectXamlSerializer

Constructors

C#
public XamlSerializer()

Fields

C#
protected Dictionary<Type, List<XamlSerializer.AttachedProperty>> AttachedProperties
C#
protected static readonly TypeConverter BuiltIn
C#
protected HashSet<Type> DiscoveredTypes
C#
protected static readonly IEqualityComparer<PropertyInfo> PropEquals
C#
protected HashSet<PropertyInfo> PropertiesToSkip
C#
protected static readonly IEqualityComparer<object> RefEquals
C#
protected IDictionary<Type, TypeConverter> TypeConverters
C#
public const string XamlNamespace = "http://schemas.microsoft.com/winfx/2006/xaml"

Methods

C#
protected virtual bool CanWriteObject(object obj, HashSet<object> cycleCheckObjects)
Parameters:objobjectcycleCheckObjectsHashSet<object>Returns:

bool

C#
protected bool CanWriteProperty(PropertyInfo propertyInfo)
Parameters:propertyInfoPropertyInfoReturns:

bool

Discovers attached properties defined in the specified assembly.

C#
public void DiscoverAttachedProperties(Assembly asm)
Parameters:asmAssembly

The assembly to search for attached properties.

Discovers all attached properties defined for the specified type.

C#
public void DiscoverAttachedProperties(Type type)
Parameters:typeType

The type for which to discover attached properties.

C#
protected virtual string GetAttachedOrder(XamlSerializer.AttachedProperty attachedProperty)
Parameters:attachedPropertyXamlSerializer.AttachedPropertyReturns:

string

C#
protected IEnumerable<XamlSerializer.AttachedProperty> GetAttachedProperties(Type type)
Parameters:typeTypeReturns:

IEnumerable<XamlSerializer.AttachedProperty>

C#
protected PropertyInfo GetContentProperty(object obj)
Parameters:objobjectReturns:

PropertyInfo

C#
protected string GetNamespace(Type type, IDictionary<string, string> prefixMappings)
Parameters:typeTypeprefixMappingsIDictionary<string, string>Returns:

string

C#
protected virtual string GetPrefix(string ns, IDictionary<string, string> prefixMappings, XmlWriter writer)
Parameters:nsstringprefixMappingsIDictionary<string, string>writerXmlWriterReturns:

string

C#
protected static Func<object, object> GetPropertyGetter(PropertyInfo propertyInfo)
Parameters:propertyInfoPropertyInfoReturns:

Func<object, object>

C#
protected virtual string GetPropertyOrder(PropertyInfo prop)
Parameters:propPropertyInfoReturns:

string

C#
protected TypeConverter GetTypeConverter(MemberInfo memberInfo)
Parameters:memberInfoMemberInfoReturns:

TypeConverter

C#
protected virtual XmlWriter GetXmlWriter(StringBuilder output)
Parameters:outputStringBuilderReturns:

XmlWriter

C#
protected static bool IsDictionary(Type type)
Parameters:typeTypeReturns:

bool

C#
protected virtual bool IsInlinable(object obj, object propValue, MemberInfo memberInfo, HashSet<object> cycleCheckObjects)
Parameters:objobjectpropValueobjectmemberInfoMemberInfocycleCheckObjectsHashSet<object>Returns:

bool

C#
protected bool IsInlineAttachedProperty(object obj, object propValue, MethodInfo methodInfo, HashSet<object> cycleCheckObjects)
Parameters:objobjectpropValueobjectmethodInfoMethodInfocycleCheckObjectsHashSet<object>Returns:

bool

C#
protected bool IsInlineProperty(object obj, object propValue, PropertyInfo prop, HashSet<object> cycleCheckObjects)
Parameters:objobjectpropValueobjectpropPropertyInfocycleCheckObjectsHashSet<object>Returns:

bool

C#
protected static bool IsList(Type type)
Parameters:typeTypeReturns:

bool

C#
protected bool IsUnique(object obj, HashSet<object> cycleCheckObjects)
Parameters:objobjectcycleCheckObjectsHashSet<object>Returns:

bool

C#
protected virtual void PostSerialize(object obj, ref string value)
Parameters:objobjectvaluestring
C#
protected virtual void PreSerialize(object obj, Dictionary<string, string> prefixMappings, HashSet<object> cycleCheckObjects)
Parameters:objobjectprefixMappingsDictionary<string, string>cycleCheckObjectsHashSet<object>

Registers an attached property using the specified getter and setter methods.

C#
public bool RegisterAttachedProperty(MethodInfo getter, MethodInfo setter)
Parameters:getterMethodInfo

The MethodInfo representing the getter method for the attached property.

setterMethodInfo

The MethodInfo representing the setter method for the attached property.

Returns:

bool

Returns a boolean value indicating whether the registration of the attached property was successful.

C#
protected virtual bool ShouldSerialize(object obj, object propValue, PropertyInfo prop)
Parameters:objobjectpropValueobjectpropPropertyInfoReturns:

bool

C#
protected virtual void VisitAfterAttributes(object obj, XmlWriter writer, IDictionary<string, string> prefixMappings, HashSet<object> cycleCheckObjects)
Parameters:objobjectwriterXmlWriterprefixMappingsIDictionary<string, string>cycleCheckObjectsHashSet<object>
C#
protected virtual void VisitAfterBeginElement(object obj, XmlWriter writer, IDictionary<string, string> prefixMappings, HashSet<object> cycleCheckObjects)
Parameters:objobjectwriterXmlWriterprefixMappingsIDictionary<string, string>cycleCheckObjectsHashSet<object>
C#
protected virtual void VisitAlternateContent(object obj, XmlWriter writer, IDictionary<string, string> prefixMappings, HashSet<object> cycleCheckObjects)
Parameters:objobjectwriterXmlWriterprefixMappingsIDictionary<string, string>cycleCheckObjectsHashSet<object>
C#
protected virtual void VisitAttachedProperty(object obj, object propValue, string propertyName, MethodInfo getter, MethodInfo setter, XmlWriter writer, IDictionary<string, string> prefixMappings, HashSet<object> cycleCheckObjects)
Parameters:objobjectpropValueobjectpropertyNamestringgetterMethodInfosetterMethodInfowriterXmlWriterprefixMappingsIDictionary<string, string>cycleCheckObjectsHashSet<object>
C#
protected virtual void VisitBeforeEndElement(object obj, XmlWriter writer, IDictionary<string, string> prefixMappings, HashSet<object> cycleCheckObjects)
Parameters:objobjectwriterXmlWriterprefixMappingsIDictionary<string, string>cycleCheckObjectsHashSet<object>
C#
protected virtual void VisitCollectionContents(IEnumerable collection, XmlWriter writer, IDictionary<string, string> prefixMappings, HashSet<object> cycleCheckObjects)
Parameters:collectionIEnumerablewriterXmlWriterprefixMappingsIDictionary<string, string>cycleCheckObjectsHashSet<object>
C#
protected virtual void VisitDictionaryContents(IDictionary dictionary, XmlWriter writer, IDictionary<string, string> prefixMappings, HashSet<object> cycleCheckObjects)
Parameters:dictionaryIDictionarywriterXmlWriterprefixMappingsIDictionary<string, string>cycleCheckObjectsHashSet<object>
C#
protected virtual void VisitKey(object key, XmlWriter writer, IDictionary<string, string> prefixMappings, HashSet<object> cycleCheckObjects)
Parameters:keyobjectwriterXmlWriterprefixMappingsIDictionary<string, string>cycleCheckObjectsHashSet<object>
C#
protected virtual void VisitObject(object obj, XmlWriter writer, IDictionary<string, string> prefixMappings, HashSet<object> cycleCheckObjects, bool isRoot = false, object key = null)
Parameters:objobjectwriterXmlWriterprefixMappingsIDictionary<string, string>cycleCheckObjectsHashSet<object>isRootboolkeyobject
C#
protected virtual void VisitProperty(object obj, object propValue, PropertyInfo prop, bool isContentProperty, XmlWriter writer, IDictionary<string, string> prefixMappings, HashSet<object> cycleCheckObjects)
Parameters:objobjectpropValueobjectpropPropertyInfoisContentPropertyboolwriterXmlWriterprefixMappingsIDictionary<string, string>cycleCheckObjectsHashSet<object>
C#
protected virtual void VisitRootAttribute(object obj, XmlWriter writer, IDictionary<string, string> prefixMappings, HashSet<object> cycleCheckObjects)
Parameters:objobjectwriterXmlWriterprefixMappingsIDictionary<string, string>cycleCheckObjectsHashSet<object>
In this article
DefinitionConstructorsXamlSerializer()FieldsAttachedPropertiesBuiltInDiscoveredTypesPropEqualsPropertiesToSkipRefEqualsTypeConvertersXamlNamespaceMethodsCanWriteObject(object, HashSet<object>)CanWriteProperty(PropertyInfo)DiscoverAttachedProperties(Assembly)DiscoverAttachedProperties(Type)GetAttachedOrder(AttachedProperty)GetAttachedProperties(Type)GetContentProperty(object)GetNamespace(Type, IDictionary<string, string>)GetPrefix(string, IDictionary<string, string>, XmlWriter)GetPropertyGetter(PropertyInfo)GetPropertyOrder(PropertyInfo)GetTypeConverter(MemberInfo)GetXmlWriter(StringBuilder)IsDictionary(Type)IsInlinable(object, object, MemberInfo, HashSet<object>)IsInlineAttachedProperty(object, object, MethodInfo, HashSet<object>)IsInlineProperty(object, object, PropertyInfo, HashSet<object>)IsList(Type)IsUnique(object, HashSet<object>)PostSerialize(object, ref string)PreSerialize(object, Dictionary<string, string>, HashSet<object>)RegisterAttachedProperty(MethodInfo, MethodInfo)ShouldSerialize(object, object, PropertyInfo)VisitAfterAttributes(object, XmlWriter, IDictionary<string, string>, HashSet<object>)VisitAfterBeginElement(object, XmlWriter, IDictionary<string, string>, HashSet<object>)VisitAlternateContent(object, XmlWriter, IDictionary<string, string>, HashSet<object>)VisitAttachedProperty(object, object, string, MethodInfo, MethodInfo, XmlWriter, IDictionary<string, string>, HashSet<object>)VisitBeforeEndElement(object, XmlWriter, IDictionary<string, string>, HashSet<object>)VisitCollectionContents(IEnumerable, XmlWriter, IDictionary<string, string>, HashSet<object>)VisitDictionaryContents(IDictionary, XmlWriter, IDictionary<string, string>, HashSet<object>)VisitKey(object, XmlWriter, IDictionary<string, string>, HashSet<object>)VisitObject(object, XmlWriter, IDictionary<string, string>, HashSet<object>, bool, object)VisitProperty(object, object, PropertyInfo, bool, XmlWriter, IDictionary<string, string>, HashSet<object>)VisitRootAttribute(object, XmlWriter, IDictionary<string, string>, HashSet<object>)
Not finding the help you need?
Contact Support