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 指派給 ,則不會發生任何動作。

適用於