DataColumnSelectionConverter.CanConvertFrom(ITypeDescriptorContext, Type) 方法

定义

指示指定的源类型是否可转换为关联控件属性的类型。Indicates whether the specified source type can be converted to the type of the associated control property.

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

参数

context
ITypeDescriptorContext

可用于获取附加上下文信息的 ITypeDescriptorContext 实现。An ITypeDescriptorContext implementation that can be used to gain additional context information.

sourceType
Type

要转换的类型。The type to convert from.

返回

如果转换器能执行转换,则为 true;否则为 falsetrue if the converter can perform the conversion; otherwise, false.

注解

调用 CanConvertFrom 方法,以确定 ConvertFrom 方法是否支持转换源类型。Call the CanConvertFrom method to determine whether the ConvertFrom method supports converting the source type.

ConvertFrom 方法只能从字符串进行转换,因此当 sourceType 是一个字符串时,CanConvertFrom 方法返回 trueThe ConvertFrom method can convert only from a string, so the CanConvertFrom method returns true when sourceType is a string.

适用于