語言

IValueConverter.Convert(Object, Type, Object, CultureInfo) 方法

定義

轉換一個數值。

public:
 System::Object ^ Convert(System::Object ^ value, Type ^ targetType, System::Object ^ parameter, System::Globalization::CultureInfo ^ culture);
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture);
abstract member Convert : obj * Type * obj * System.Globalization.CultureInfo -> obj
Public Function Convert (value As Object, targetType As Type, parameter As Object, culture As CultureInfo) As Object

參數

value
Object

結合源所產生的價值。

targetType
Type

結合目標屬性的類型。

parameter
Object

轉換器參數要用。

culture
CultureInfo

培養物要用於轉換器。

傳回

一個轉換後的價值。 若方法回傳 null,則使用有效的空值。

備註

資料綁定引擎在將綁定來源的值傳播到綁定目標時,會呼叫此方法。

資料綁定引擎不會捕捉由使用者提供的轉換器拋出的異常。 方法拋出 Convert 的任何例外,或是方法呼叫的方法拋出 Convert 的未捕捉異常,都被視為執行時錯誤。 處理預期中的問題時,請退 DependencyProperty.UnsetValue回。

回傳值 DependencyProperty.UnsetValue 表示轉換器未產生任何值,綁定使用 FallbackValue(若有)或預設值。

回傳值 Binding.DoNothing 表示綁定未轉移該值或使用 FallbackValue 預設值。

適用於