BindableProperty.CreateReadOnly Method

Definition

Overloads

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

Creates a new instance of the BindablePropertyKey class.

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

Deprecated. Do not use.

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

Creates a new instance of the BindablePropertyKey class.

public static Xamarin.Forms.BindablePropertyKey CreateReadOnly (string propertyName, Type returnType, Type declaringType, object defaultValue, Xamarin.Forms.BindingMode defaultBindingMode = Xamarin.Forms.BindingMode.OneWayToSource, 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 CreateReadOnly : 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.BindablePropertyKey

Parameters

propertyName
String

The name of the BindableProperty.

returnType
Type

The type of the property.

declaringType
Type

The type of the declaring object.

defaultValue
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

Applies to

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

Caution

CreateReadOnly<> (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("CreateReadOnly<> (generic) is obsolete as of version 2.1.0 and is no longer supported.")]
public static Xamarin.Forms.BindablePropertyKey CreateReadOnly<TDeclarer,TPropertyType> (System.Linq.Expressions.Expression<Func<TDeclarer,TPropertyType>> getter, TPropertyType defaultValue, Xamarin.Forms.BindingMode defaultBindingMode = Xamarin.Forms.BindingMode.OneWayToSource, 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<TDeclarer,TPropertyType> defaultValueCreator = default) where TDeclarer : Xamarin.Forms.BindableObject;
static member CreateReadOnly : System.Linq.Expressions.Expression<Func<'Declarer, '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<'Declarer, 'PropertyType (requires 'Declarer :> Xamarin.Forms.BindableObject)> -> Xamarin.Forms.BindablePropertyKey (requires 'Declarer :> Xamarin.Forms.BindableObject)

Type Parameters

TDeclarer

The type of the declaring object.

TPropertyType

The type of the property.

Parameters

getter
Expression<Func<TDeclarer,TPropertyType>>

An expression identifying the getter for 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<TDeclarer,TPropertyType>

A Func used to initialize default value for reference types.

Returns

A newly created BindablePropertyKey.

Attributes

Remarks

A BindablePropertyKey is used to restrict write access to a property, either via SetValue() or binding. A BindableProperty is usually defined too, to give broader read access

Applies to