FrameworkPropertyMetadata.IsDataBindingAllowed Property

Definition

Gets a value that indicates whether data binding is supported for the dependency property.

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

Property Value

true if data binding is supported on the dependency property to which this metadata applies; otherwise, false. The default is true.

Examples

The following example obtains the default metadata from various dependency property fields, queries the value of various FrameworkPropertyMetadata properties on it, and uses the information to populate a table to implement a "metadata browser".

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")

Remarks

This property reports false for one of two possible conditions: either data binding to a dependency property is not allowed because the dependency property is read-only (as reported in the dependency property identifier, not the metadata), or the value of another metadata property, IsNotDataBindable, is set to true in this metadata. This property is exposed as a convenience so that callers do not have to check both ReadOnly and IsNotDataBindable.

If you are attempting to create metadata that specifies that an otherwise read/write property should not support data binding, specify the flag NotDataBindable (note the slight naming convention difference versus IsNotDataBindable).

XAML Text Usage

Members of this class are not typically used in XAML.

Applies to

See also