XamlTypeMapper Class

Maps a XAML element name to the appropriate CLR Type in assemblies.

System.Object
  System.Windows.Markup.XamlTypeMapper

Namespace:  System.Windows.Markup
Assembly:  PresentationFramework (in PresentationFramework.dll)
XMLNS for XAML: http://schemas.microsoft.com/winfx/2006/xaml

'Declaration
Public Class XamlTypeMapper

The XamlTypeMapper type exposes the following members.

  NameDescription
Public methodXamlTypeMapper(String())Initializes a new instance of the XamlTypeMapper class by specifying an array of assembly names that the XamlTypeMapper should use.
Public methodXamlTypeMapper(String(), NamespaceMapEntry())Initializes a new instance of the XamlTypeMapper class, using the specified array of assembly names and the specified namespace maps.
Top

  NameDescription
Public propertyStatic memberDefaultMapperGets an instance of the XamlTypeMapper to use if one has not been specified.
Top

  NameDescription
Public methodAddMappingProcessingInstructionDefines a mapping between an XML namespace and CLR namespaces in assemblies, and adds these to the XamlTypeMapper information.
Protected methodAllowInternalTypeRequests permission for a XamlTypeMapper derived type that is called under full trust to access a specific internal type.
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 the default hash function. (Inherited from Object.)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Public methodGetType(String, String)Gets the CLR Type that a given XAML element is mapped to, using the specified XML namespace prefix and element name.
Protected methodMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Public methodSetAssemblyPathSpecifies the path to use when loading an assembly.
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)
Top

XamlTypeMapper is part of an advanced WPF scenario that supplies alternate context for XamlReader and XamlWriter. For .NET Framework 4 WPF applications, you should consider overriding XamlSchemaContext for this scenario, rather than attempting to use XamlTypeMapper.

XamlTypeMapper can be used to provide the XAML parser with custom mapping information through a more direct technique than the application of XmlnsDefinitionAttribute values on the assembly code. This might be useful for consolidation of all CLR namespaces in an assembly, or for referencing types that are XAML-ready in an existing assembly without having to recompile it just to add XmlnsDefinitionAttribute attributing.

You typically create a XamlTypeMapper instance in order to specify the XamlTypeMapper property value for a ParserContext. The ParserContext in turn can be used as the context for a XamlReader.Load(Stream, ParserContext) call.

Default Mapper

You can obtain a default mapper using the DefaultMapper static property. The default mapper only works on a default assembly list. No specific information about assemblies (as is specified in XamlTypeMapper constructors) is used.

.NET Framework

Supported in: 4.5, 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

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.
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft