Windows apps
Collapse the table of content
Expand the table of content
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

XamlMember.TypeConverter Property

.NET Framework (current version)
 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

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
Available since 4.0
Return to top
Show:
© 2018 Microsoft