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;否则为 false。true 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方法只可从字符串进行转换,因此 CanConvertFrom true 当是一个字符串时,此方法将返回 sourceType 。The ConvertFrom method can convert only from a string, so the CanConvertFrom method returns true when sourceType is a string.