Edit

Bagikan melalui


IDestinationTypeProvider Interface

Definition

Represents a service that can return a CLR type system identifier for the destination type. The destination type is relevant when the destination type for a property-setting operation is indirectly reported by reflection or other mechanisms.

public interface class IDestinationTypeProvider
public interface IDestinationTypeProvider
type IDestinationTypeProvider = interface
Public Interface IDestinationTypeProvider

Remarks

The type that is returned by GetDestinationType is resolved from the current position of the XAML node stream by using current XAML schema context.

If you use the XAML type system as implemented by .NET Framework XAML Services and access the service context under these conditions, GetDestinationType returns the UnderlyingType based on available XAML type system information and CLR-based XAML schema context.

This service is relevant for situations where pure CLR reflection or other mechanisms might not provide enough information about a destination type. The following is a list of some relevant scenarios for IDestinationTypeProvider:

  • The CLR type system reports an indirect type because of how the CLR defines and uses types, and you want a true destination type. For example, the APIs in .NET Framework XAML Services use this service internally when they process event members. Events are reported by pure CLR reflection as a Delegate.

  • You want to ensure that the destination type of a type converter usage matches the expected type that the type converter can produce. This scenario is useful when the destination type is parameterized or generic.

  • Your value converter is being called from a usage that nested in another value converter. In this case, GetDestinationType unwinds the nesting and returns the destination type of the actual property being set, instead of returning the output type of any intervening value converter.

Type converters and markup extensions can query for IDestinationTypeProvider as a service on the service context that is provided by a XAML object writer, when the XAML object writer invokes value conversion behavior. For more information, see Type Converters and Markup Extensions for XAML and Service Contexts Available to Type Converters and Markup Extensions.

Methods

GetDestinationType()

Returns the CLR Type that identifies the destination type for the relevant type converter or markup extension.

Applies to

See also