BindableObject.CoerceValue 方法

定义

重载

CoerceValue(BindableProperty)

强制指定可绑定属性的值。 这是通过调用 BindableProperty.CoerceValueDelegate 指定的可绑定属性来完成的。

CoerceValue(BindablePropertyKey)

强制指定可绑定属性的值。 这是通过调用 BindableProperty.CoerceValueDelegate 指定的可绑定属性来完成的。

CoerceValue(BindableProperty)

强制指定可绑定属性的值。 这是通过调用 BindableProperty.CoerceValueDelegate 指定的可绑定属性来完成的。

public:
 void CoerceValue(Microsoft::Maui::Controls::BindableProperty ^ property);
public void CoerceValue (Microsoft.Maui.Controls.BindableProperty property);
member this.CoerceValue : Microsoft.Maui.Controls.BindableProperty -> unit
Public Sub CoerceValue (property As BindableProperty)

参数

property
BindableProperty

可绑定属性,用于强制其值。

例外

propertynull 时,将引发此异常。

当 为 只读 时 property 引发。

根据 中 BindableProperty.ValidateValueDelegate分配的逻辑的值无效时引发。

注解

如果未 BindableProperty.CoerceValueDelegate 分配给 ,则不会发生任何操作。

适用于

CoerceValue(BindablePropertyKey)

强制指定可绑定属性的值。 这是通过调用 BindableProperty.CoerceValueDelegate 指定的可绑定属性来完成的。

public:
 void CoerceValue(Microsoft::Maui::Controls::BindablePropertyKey ^ propertyKey);
public void CoerceValue (Microsoft.Maui.Controls.BindablePropertyKey propertyKey);
member this.CoerceValue : Microsoft.Maui.Controls.BindablePropertyKey -> unit
Public Sub CoerceValue (propertyKey As BindablePropertyKey)

参数

propertyKey
BindablePropertyKey

标识要强制其值的可绑定属性的键。

例外

propertyKeynull 时,将引发此异常。

当 标识 propertyKey 的可绑定属性为只读时引发。

根据 中 BindableProperty.ValidateValueDelegate分配的逻辑的值无效时引发。

注解

如果未 BindableProperty.CoerceValueDelegate 分配给 ,则不会发生任何操作。

适用于