ImageSourceTypeConverter.ConvertTo 方法

定义

BitmapSource 转换为指定类型的对象。

public:
 override System::Object ^ ConvertTo(System::ComponentModel::ITypeDescriptorContext ^ context, System::Globalization::CultureInfo ^ culture, System::Object ^ value, Type ^ destinationType);
[System.Security.SecurityCritical]
[System.Security.SecurityTreatAsSafe]
public override object ConvertTo (System.ComponentModel.ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType);
[System.Security.SecurityTreatAsSafe]
public override object ConvertTo (System.ComponentModel.ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType);
[<System.Security.SecurityCritical>]
[<System.Security.SecurityTreatAsSafe>]
override this.ConvertTo : System.ComponentModel.ITypeDescriptorContext * System.Globalization.CultureInfo * obj * Type -> obj
[<System.Security.SecurityTreatAsSafe>]
override this.ConvertTo : System.ComponentModel.ITypeDescriptorContext * System.Globalization.CultureInfo * obj * Type -> obj
Public Overrides Function ConvertTo (context As ITypeDescriptorContext, culture As CultureInfo, value As Object, destinationType As Type) As Object

参数

context
ITypeDescriptorContext

提供上下文信息的对象。

culture
CultureInfo

转换期间使用的语言和区域性。

value
Object

要转换的对象。

destinationType
Type

要将 value 转换为的类型。

返回

Object

指定的类型的新 Object。 在此类中实现时,该对象必须为 Uri。 对象表示序列化映像的统一资源标识符 (URI)。

属性

例外

destinationType 不是 value 可以转换为的类型。

contextnull

valuenull

序列化图像时发生错误。

注解

如此类中实现的那样, value 必须是一个 BitmapSource

在此类中实现时, destinationType 必须是或 Uri 引发该 NotSupportedException 类。

culture不使用参数。 请参阅 继承者的说明

继承者说明

重写此方法以提供自己的转换。 使用 culture 参数指定语言和区域性。 使用 context 参数提取有关调用此转换器的环境的附加信息。 此参数可以是 null;因此,请始终检查它。 同样,context 对象的属性也可能返回空引用 (Nothing)。

适用于