แก้ไข

แชร์ผ่าน


OpacityConverter.CanConvertFrom(ITypeDescriptorContext, Type) Method

Definition

Returns a value indicating whether this converter can convert an object of the specified source type to the native type of the converter that uses the specified context.

public:
 override bool CanConvertFrom(System::ComponentModel::ITypeDescriptorContext ^ context, Type ^ sourceType);
public override bool CanConvertFrom (System.ComponentModel.ITypeDescriptorContext context, Type sourceType);
public override bool CanConvertFrom (System.ComponentModel.ITypeDescriptorContext? context, Type sourceType);
override this.CanConvertFrom : System.ComponentModel.ITypeDescriptorContext * Type -> bool
Public Overrides Function CanConvertFrom (context As ITypeDescriptorContext, sourceType As Type) As Boolean

Parameters

context
ITypeDescriptorContext

A ITypeDescriptorContext that provides information about the context of a type converter.

sourceType
Type

The Type that represents the type you want to convert from.

Returns

true if this converter can perform the conversion; otherwise, false.

Remarks

The sourceType is expected to be a String.

Notes to Inheritors

Override this method to provide your own conversion requirements.

You can use the context parameter to extract additional information about the environment this converter is being invoked from. The parameter may be null, so you should always verify the contents. Also, properties on the ITypeDescriptorContext may also return null.

Applies to

See also