Export (0) Print
Expand All

XamlMember.TypeConverter Property

Gets a XamlValueConverter<TConverterBase> object, which can be used for type conversion construction of XAML declared objects.

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

public XamlValueConverter<TypeConverter> TypeConverter { get; }

Property Value

Type: System.Xaml.Schema.XamlValueConverter<TypeConverter>
A XamlValueConverter<TConverterBase> value, with a TypeConverter constraint on the generic. See Remarks.

Calling TypeConverter invokes LookupTypeConverter or a specific override of that method. This behavior occurs when the initial internal reflection logic has not already set the information.

Implementations that return a non-null property value for TypeConverter are not necessarily a working TypeConverter. The following is a list of possible non-null return values for TypeConverter and what these values represent:

  • The return value reports a type converter that is attributed specifically to that member or more generally to the target type of the converter. This behavior is typically what most XAML type systems and XAML processors look for in order to instantiate a type converter and invoke its methods.

  • The return value reports a built-in value converter. These converters exist for certain internal operations that are performed by a XAML writer. In particular, these built-in value converters convert the raw attribute string values to the XAML language-level primitives. For the .NET Framework XAML Services implementation, these built-in type conversions often forward to a type converter that is defined in the System assembly. For example, a conversion for an Int32 value has built-in forwarded conversion, and therefore, the ConverterType value references Int32Converter.

  • The return value reports the special case of an unconstrained object model; that is, the XamlMember has a Type value of Object. In this case, the XamlValueConverter<TConverterBase> reports that the XamlValueConverter<TConverterBase>.Name is {Object}. However, ConverterInstance is null because no actual type or instance is available to perform this conversion. Instead, the object model behavior cannot be determined until run time, when the runtime of the specific technology determines the handling of its object graph.

If you can access a working TypeConverter from ConverterInstance, you can invoke its conversion methods. However, many conversion methods rely on service context. If you do not have the same service context available that the type converter expects for its typical role of writing objects for object graphs, the converter methods can throw exceptions.

.NET Framework

Supported in: 4.5, 4

.NET Framework Client Profile

Supported in: 4

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.

Show:
© 2014 Microsoft