KeyGestureConverter.ConvertTo(ITypeDescriptorContext, CultureInfo, Object, Type) 方法

定義

使用指定的內容,嘗試將 KeyGesture 轉換為指定的型別。Attempts to convert a KeyGesture to the specified type, using the specified context.

public:
 override System::Object ^ ConvertTo(System::ComponentModel::ITypeDescriptorContext ^ context, System::Globalization::CultureInfo ^ culture, System::Object ^ value, Type ^ destinationType);
public override object ConvertTo (System.ComponentModel.ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType);
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

格式內容,提供正在叫用此轉換器之環境的相關資訊。A format context that provides information about the environment from which this converter is being invoked.

culture
CultureInfo

特定文化特性 (Culture) 資訊。Culture specific information.

value
Object

要轉換的物件。The object to convert.

destinationType
Type

要將物件轉換成的類型。The type to convert the object to.

傳回

轉換的物件,如果 valuenull 則為空字串。The converted object, or an empty string if value is null.

例外狀況

destinationTypenulldestinationType is null.

無法轉換 valuevalue cannot be converted.

備註

destinationType必須是StringdestinationType must be String.

會使用 "+" 索引鍵做為輔助按鍵與索引鍵之間的分隔符號, 以轉換為和。KeyGestureConverter StringThe KeyGestureConverter converts to and from a String using the "+" key as the delimiter between the modifier keys and the key. 例如KeyGesture , Modifiers屬性等於Control且屬性Key等於Control+A的會轉換成字串。 AFor example, a KeyGesture with a Modifiers property equal to Control and Key property equal to A would be converted into the string Control+A.

適用於