BindableProperty.CreateAttached 方法

定義

多載

CreateAttached(String, Type, Type, Object, BindingMode, BindableProperty+ValidateValueDelegate, BindableProperty+BindingPropertyChangedDelegate, BindableProperty+BindingPropertyChangingDelegate, BindableProperty+CoerceValueDelegate, BindableProperty+CreateDefaultValueDelegate)

建立附加屬性 BindableProperty 類別的新執行個體。

CreateAttached<TDeclarer,TPropertyType>(Expression<Func<BindableObject, TPropertyType>>, TPropertyType, BindingMode, BindableProperty.ValidateValueDelegate<TPropertyType>, BindableProperty.BindingPropertyChangedDelegate<TPropertyType>, BindableProperty.BindingPropertyChangingDelegate<TPropertyType>, BindableProperty.CoerceValueDelegate<TPropertyType>, BindableProperty.CreateDefaultValueDelegate<BindableObject, TPropertyType>)
已淘汰.

已取代。 請勿使用。

CreateAttached(String, Type, Type, Object, BindingMode, BindableProperty+ValidateValueDelegate, BindableProperty+BindingPropertyChangedDelegate, BindableProperty+BindingPropertyChangingDelegate, BindableProperty+CoerceValueDelegate, BindableProperty+CreateDefaultValueDelegate)

建立附加屬性 BindableProperty 類別的新執行個體。

public static Xamarin.Forms.BindableProperty CreateAttached (string propertyName, Type returnType, Type declaringType, object defaultValue, Xamarin.Forms.BindingMode defaultBindingMode = Xamarin.Forms.BindingMode.OneWay, Xamarin.Forms.BindableProperty.ValidateValueDelegate validateValue = default, Xamarin.Forms.BindableProperty.BindingPropertyChangedDelegate propertyChanged = default, Xamarin.Forms.BindableProperty.BindingPropertyChangingDelegate propertyChanging = default, Xamarin.Forms.BindableProperty.CoerceValueDelegate coerceValue = default, Xamarin.Forms.BindableProperty.CreateDefaultValueDelegate defaultValueCreator = default);
static member CreateAttached : string * Type * Type * obj * Xamarin.Forms.BindingMode * Xamarin.Forms.BindableProperty.ValidateValueDelegate * Xamarin.Forms.BindableProperty.BindingPropertyChangedDelegate * Xamarin.Forms.BindableProperty.BindingPropertyChangingDelegate * Xamarin.Forms.BindableProperty.CoerceValueDelegate * Xamarin.Forms.BindableProperty.CreateDefaultValueDelegate -> Xamarin.Forms.BindableProperty

參數

propertyName
System.String

BindableProperty 的名稱。

returnType
System.Type

屬性的類型。

declaringType
System.Type

宣告物件的類型。

defaultValue
System.Object

屬性的預設值。

defaultBindingMode
BindingMode

如果未提供任何 BindingMode,要在 SetBinding() 上使用的 BindingMode。 這是選擇性參數。 預設為 BindingMode.OneWay。

validateValue
BindableProperty.ValidateValueDelegate

設定值時要執行的委派。 這是選擇性參數。 預設為 Null。

propertyChanged
BindableProperty.BindingPropertyChangedDelegate

變更值時要執行的委派。 這是選擇性參數。 預設為 Null。

propertyChanging
BindableProperty.BindingPropertyChangingDelegate

將變更值時要執行的委派。 這是選擇性參數。 預設為 Null。

coerceValue
BindableProperty.CoerceValueDelegate

用來強制轉型值範圍的委派。 這是選擇性參數。 預設為 Null。

defaultValueCreator
BindableProperty.CreateDefaultValueDelegate

用來初始化參考類型預設值的函式。

傳回

新建立的附加 BindableProperty。

適用於

CreateAttached<TDeclarer,TPropertyType>(Expression<Func<BindableObject, TPropertyType>>, TPropertyType, BindingMode, BindableProperty.ValidateValueDelegate<TPropertyType>, BindableProperty.BindingPropertyChangedDelegate<TPropertyType>, BindableProperty.BindingPropertyChangingDelegate<TPropertyType>, BindableProperty.CoerceValueDelegate<TPropertyType>, BindableProperty.CreateDefaultValueDelegate<BindableObject, TPropertyType>)

警告

CreateAttached<> (generic) is obsolete as of version 2.1.0 and is no longer supported.

已取代。 請勿使用。

[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
[System.Obsolete("CreateAttached<> (generic) is obsolete as of version 2.1.0 and is no longer supported.")]
public static Xamarin.Forms.BindableProperty CreateAttached<TDeclarer,TPropertyType> (System.Linq.Expressions.Expression<Func<Xamarin.Forms.BindableObject,TPropertyType>> staticgetter, TPropertyType defaultValue, Xamarin.Forms.BindingMode defaultBindingMode = Xamarin.Forms.BindingMode.OneWay, Xamarin.Forms.BindableProperty.ValidateValueDelegate<TPropertyType> validateValue = default, Xamarin.Forms.BindableProperty.BindingPropertyChangedDelegate<TPropertyType> propertyChanged = default, Xamarin.Forms.BindableProperty.BindingPropertyChangingDelegate<TPropertyType> propertyChanging = default, Xamarin.Forms.BindableProperty.CoerceValueDelegate<TPropertyType> coerceValue = default, Xamarin.Forms.BindableProperty.CreateDefaultValueDelegate<Xamarin.Forms.BindableObject,TPropertyType> defaultValueCreator = default);
static member CreateAttached : System.Linq.Expressions.Expression<Func<Xamarin.Forms.BindableObject, 'PropertyType>> * 'PropertyType * Xamarin.Forms.BindingMode * Xamarin.Forms.BindableProperty.ValidateValueDelegate<'PropertyType> * Xamarin.Forms.BindableProperty.BindingPropertyChangedDelegate<'PropertyType> * Xamarin.Forms.BindableProperty.BindingPropertyChangingDelegate<'PropertyType> * Xamarin.Forms.BindableProperty.CoerceValueDelegate<'PropertyType> * Xamarin.Forms.BindableProperty.CreateDefaultValueDelegate<Xamarin.Forms.BindableObject, 'PropertyType> -> Xamarin.Forms.BindableProperty

類型參數

TDeclarer

宣告物件的類型。

TPropertyType

屬性的類型。

參數

staticgetter
System.Linq.Expressions.Expression<System.Func<BindableObject,TPropertyType>>

識別靜態方法的運算式,此方法使用此 BindableProperty 作為備份存放區來傳回屬性的值。

defaultValue
TPropertyType

BindableProperty 的預設值。

defaultBindingMode
BindingMode

如果未提供任何 BindingMode,要在 SetBinding() 上使用的 BindingMode。 這是選擇性參數。 預設為 BindingMode.OneWay。

validateValue
BindableProperty.ValidateValueDelegate<TPropertyType>

設定值時要執行的委派。 這是選擇性參數。 預設為 Null。

propertyChanged
BindableProperty.BindingPropertyChangedDelegate<TPropertyType>

變更值時要執行的委派。 這是選擇性參數。 預設為 Null。

propertyChanging
BindableProperty.BindingPropertyChangingDelegate<TPropertyType>

將變更值時要執行的委派。 這是選擇性參數。 預設為 Null。

coerceValue
BindableProperty.CoerceValueDelegate<TPropertyType>

用來強制轉型值範圍的委派。 這是選擇性參數。 預設為 Null。

defaultValueCreator
BindableProperty.CreateDefaultValueDelegate<BindableObject,TPropertyType>

用來初始化參考類型預設值的函式。

傳回

新建立的 BindableProperty。

屬性
System.ComponentModel.EditorBrowsableAttribute System.ObsoleteAttribute

備註

附加屬性是系結至其父代以外的物件之可系結屬性。 它們通常用於數據表和方格中的子專案,其中專案位置的相關數據是由其父代維護,但必須從子專案本身存取。

適用於