BindableProperty.CreateAttached Method

Definition

Overloads

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

Creates a new instance of the BindableProperty class for an attached property.

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>)
Obsolete.

Deprecated. Do not use.

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

Creates a new instance of the BindableProperty class for an attached property.

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

Parameters

propertyName
System.String

The name of the BindableProperty.

returnType
System.Type

The type of the property.

declaringType
System.Type

The type of the declaring object.

defaultValue
System.Object

The default value for the property.

defaultBindingMode
BindingMode

The BindingMode to use on SetBinding() if no BindingMode is given. This parameter is optional. Default is BindingMode.OneWay.

validateValue
BindableProperty.ValidateValueDelegate

A delegate to be run when a value is set. This parameter is optional. Default is null.

propertyChanged
BindableProperty.BindingPropertyChangedDelegate

A delegate to be run when the value has changed. This parameter is optional. Default is null.

propertyChanging
BindableProperty.BindingPropertyChangingDelegate

A delegate to be run when the value will change. This parameter is optional. Default is null.

coerceValue
BindableProperty.CoerceValueDelegate

A delegate used to coerce the range of a value. This parameter is optional. Default is null.

defaultValueCreator
BindableProperty.CreateDefaultValueDelegate

A Func used to initialize default value for reference types.

Returns

A newly created attached BindableProperty.

Applies to

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>)

Caution

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

Deprecated. Do not use.

[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

Type Parameters

TDeclarer

The type of the declaring object.

TPropertyType

The type of the property.

Parameters

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

An expression identifying a static method returning the value of the property using this BindableProperty as backing store.

defaultValue
TPropertyType

Default value for the BindableProperty.

defaultBindingMode
BindingMode

The BindingMode to use on SetBinding() if no BindingMode is given. This parameter is optional. Default is BindingMode.OneWay.

validateValue
BindableProperty.ValidateValueDelegate<TPropertyType>

A delegate to be run when a value is set. This parameter is optional. Default is null.

propertyChanged
BindableProperty.BindingPropertyChangedDelegate<TPropertyType>

A delegate to be run when the value has changed. This parameter is optional. Default is null.

propertyChanging
BindableProperty.BindingPropertyChangingDelegate<TPropertyType>

A delegate to be run when the value will change. This parameter is optional. Default is null.

coerceValue
BindableProperty.CoerceValueDelegate<TPropertyType>

A delegate used to coerce the range of a value. This parameter is optional. Default is null.

defaultValueCreator
BindableProperty.CreateDefaultValueDelegate<BindableObject,TPropertyType>

A Func used to initialize default value for reference types.

Returns

A newly created BindableProperty.

Attributes
System.ComponentModel.EditorBrowsableAttribute System.ObsoleteAttribute

Remarks

Attached properties are bindable properties that are bound to an object other than their parent. Often, they are used for child items in tables and grids, where data about the location of an item is maintained by its parent, but must be accessed from the child item itself.

Applies to