FrameworkPropertyMetadata.IsDataBindingAllowed 屬性

定義

取得值,指出相依性屬性是否支援資料繫結。

public:
 property bool IsDataBindingAllowed { bool get(); };
public bool IsDataBindingAllowed { get; }
member this.IsDataBindingAllowed : bool
Public ReadOnly Property IsDataBindingAllowed As Boolean

屬性值

如果套用這個中繼資料的相依性屬性支援資料繫結,則為 true;否則為 false。 預設為 true

範例

下列範例會從各種相依性屬性欄位取得預設中繼資料、查詢其上各種 FrameworkPropertyMetadata 屬性的值,並使用資訊來填入資料表來實作「中繼資料瀏覽器」。

pm = dp.GetMetadata(dp.OwnerType);
pm = dp.GetMetadata(dp.OwnerType)
FrameworkPropertyMetadata fpm = pm as FrameworkPropertyMetadata;
if (fpm!=null) {
    AffectsArrange.Text = (fpm.AffectsArrange) ? "Yes" : "No";
    AffectsMeasure.Text = (fpm.AffectsMeasure) ? "Yes" : "No";
    AffectsRender.Text = (fpm.AffectsRender) ? "Yes" : "No";
    Inherits.Text = (fpm.Inherits) ? "Yes" : "No";
    IsDataBindingAllowed.Text = (fpm.IsDataBindingAllowed) ? "Yes" : "No";
    BindsTwoWayByDefault.Text = (fpm.BindsTwoWayByDefault) ? "Yes" : "No";
}
Dim fpm As FrameworkPropertyMetadata = TryCast(pm, FrameworkPropertyMetadata)
If fpm IsNot Nothing Then
    AffectsArrange.Text = If((fpm.AffectsArrange), "Yes", "No")
    AffectsMeasure.Text = If((fpm.AffectsMeasure), "Yes", "No")
    AffectsRender.Text = If((fpm.AffectsRender), "Yes", "No")
        [Inherits].Text = If((fpm.Inherits), "Yes", "No")
    IsDataBindingAllowed.Text = If((fpm.IsDataBindingAllowed), "Yes", "No")
    BindsTwoWayByDefault.Text = If((fpm.BindsTwoWayByDefault), "Yes", "No")

備註

此屬性會報告 false 兩個可能條件之一:不允許系結至相依性屬性的資料系結,因為相依性屬性在相依性屬性識別碼中為唯讀 (,而不是中繼資料) ,或另一個中繼資料屬性 IsNotDataBindable 的值設定 true 為此中繼資料中的 。 此屬性會公開為便利性,因此呼叫端不需要同時檢查 ReadOnlyIsNotDataBindable

如果您嘗試建立中繼資料,指定其他讀取/寫入屬性不應支援資料系結,請指定旗標 NotDataBindable (請注意稍有的命名慣例差異與 IsNotDataBindable) 。

XAML 文字使用方式

這個類別的成員通常不會用於 XAML。

適用於

另請參閱