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.

OpacityConverter.CanConvertFrom Method (ITypeDescriptorContext, Type)

 
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.

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.

Namespace:   System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)

public override bool CanConvertFrom(
	ITypeDescriptorContext context,
	Type sourceType
)

Parameters

context
Type: System.ComponentModel.ITypeDescriptorContext

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

sourceType
Type: System.Type

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

Return Value

Type: System.Boolean

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

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.

.NET Framework
Available since 1.1
Return to top
Show:
© 2018 Microsoft