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
String

Имя BindableProperty.

returnType
Type

Тип свойства.

declaringType
Type

Тип объявляющего объекта.

defaultValue
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
Expression<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.

Атрибуты

Комментарии

Присоединенные свойства — это привязываемые свойства, привязанные к объекту, отличному от родительского. Часто они используются для дочерних элементов в таблицах и сетках, где данные о расположении элемента хранятся его родительским элементом, но должны быть доступны из самого дочернего элемента.

Применяется к