แก้ไข

แชร์ผ่าน


FrameworkPropertyMetadata Class

Definition

Reports or applies metadata for a dependency property, specifically adding framework-specific property system characteristics.

public ref class FrameworkPropertyMetadata : System::Windows::UIPropertyMetadata
public class FrameworkPropertyMetadata : System.Windows.UIPropertyMetadata
type FrameworkPropertyMetadata = class
    inherit UIPropertyMetadata
Public Class FrameworkPropertyMetadata
Inherits UIPropertyMetadata
Inheritance
FrameworkPropertyMetadata

Examples

The following example gets metadata for a dependency property on a particular owner as the initial base PropertyMetadata type. That metadata is cast to FrameworkPropertyMetadata. If the cast returned a valid FrameworkPropertyMetadata, then various FrameworkPropertyMetadata property values are reported through a simple UI (not shown).

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 class derives from PropertyMetadata (through UIPropertyMetadata) . For most WPF framework-level application development purposes, FrameworkPropertyMetadata is the type used for dependency property metadata, rather than the base metadata types PropertyMetadata or UIPropertyMetadata. This is true both for existing dependency properties and for most custom dependency property scenarios.

The members declared by this class that supplement the PropertyMetadata base class include various Boolean properties that specify or report WPF framework-level property system behavior such as property inheritance, data binding, and layout.

Several constructor signatures for creating a FrameworkPropertyMetadata instance take a FrameworkPropertyMetadataOptions parameter. The FrameworkPropertyMetadataOptions enumeration is used only to specify initial behavior in the constructor, and is not otherwise exposed after FrameworkPropertyMetadata is constructed. From a constructed instance, you can get or set the corresponding information through various properties that share the name of the enumeration values used in the constructor call.

XAML Text Usage

This class is not typically used in XAML.

Constructors

FrameworkPropertyMetadata()

Initializes a new instance of the FrameworkPropertyMetadata class.

FrameworkPropertyMetadata(Object, FrameworkPropertyMetadataOptions, PropertyChangedCallback, CoerceValueCallback, Boolean, UpdateSourceTrigger)

Initializes a new instance of the FrameworkPropertyMetadata class with the provided default value and framework metadata options, specified callbacks, a Boolean that can be used to prevent animation of the property, and a data-binding update trigger default.

FrameworkPropertyMetadata(Object, FrameworkPropertyMetadataOptions, PropertyChangedCallback, CoerceValueCallback, Boolean)

Initializes a new instance of the FrameworkPropertyMetadata class with the provided default value and framework metadata options, specified callbacks, and a Boolean that can be used to prevent animation of the property.

FrameworkPropertyMetadata(Object, FrameworkPropertyMetadataOptions, PropertyChangedCallback, CoerceValueCallback)

Initializes a new instance of the FrameworkPropertyMetadata class with the provided default value and framework metadata options, and specified callbacks.

FrameworkPropertyMetadata(Object, FrameworkPropertyMetadataOptions, PropertyChangedCallback)

Initializes a new instance of the FrameworkPropertyMetadata class with the provided default value and framework metadata options, and specified PropertyChangedCallback callback.

FrameworkPropertyMetadata(Object, FrameworkPropertyMetadataOptions)

Initializes a new instance of the FrameworkPropertyMetadata class with the provided default value and framework-level metadata options.

FrameworkPropertyMetadata(Object, PropertyChangedCallback, CoerceValueCallback)

Initializes a new instance of the FrameworkPropertyMetadata class with the provided default value and specified callbacks.

FrameworkPropertyMetadata(Object, PropertyChangedCallback)

Initializes a new instance of the FrameworkPropertyMetadata class with the provided default value and specified PropertyChangedCallback callback.

FrameworkPropertyMetadata(Object)

Initializes a new instance of the FrameworkPropertyMetadata class with the specified default value.

FrameworkPropertyMetadata(PropertyChangedCallback, CoerceValueCallback)

Initializes a new instance of the FrameworkPropertyMetadata class with the specified callbacks.

FrameworkPropertyMetadata(PropertyChangedCallback)

Initializes a new instance of the FrameworkPropertyMetadata class with the specified PropertyChangedCallback callback.

Properties

AffectsArrange

Gets or sets a value that indicates whether a dependency property potentially affects the arrange pass during layout engine operations.

AffectsMeasure

Gets or sets a value that indicates whether a dependency property potentially affects the measure pass during layout engine operations.

AffectsParentArrange

Gets or sets a value that indicates whether a dependency property potentially affects the arrange pass of its parent element's layout during layout engine operations.

AffectsParentMeasure

Gets or sets a value that indicates whether a dependency property potentially affects the measure pass of its parent element's layout during layout engine operations.

AffectsRender

Gets or sets a value that indicates whether a dependency property potentially affects the general layout in some way that does not specifically influence arrangement or measurement, but would require a redraw.

BindsTwoWayByDefault

Gets or sets a value that indicates whether the property binds two-way by default.

CoerceValueCallback

Gets or sets a reference to a CoerceValueCallback implementation specified in this metadata.

(Inherited from PropertyMetadata)
DefaultUpdateSourceTrigger

Gets or sets the default for UpdateSourceTrigger to use when bindings for the property with this metadata are applied, which have their UpdateSourceTrigger set to Default.

DefaultValue

Gets or sets the default value of the dependency property.

(Inherited from PropertyMetadata)
Inherits

Gets or sets a value that indicates whether the value of the dependency property is inheritable.

IsAnimationProhibited

Gets or sets a value declaring whether animations should be disabled on the dependency property where the containing metadata instance is applied.

(Inherited from UIPropertyMetadata)
IsDataBindingAllowed

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

IsNotDataBindable

Gets or sets a value that indicates whether the dependency property supports data binding.

IsSealed

Gets a value that determines whether the metadata has been applied to a property in some way, resulting in the immutable state of that metadata instance.

(Inherited from PropertyMetadata)
Journal

Gets or sets a value that indicates whether this property contains journaling information that applications can or should store as part of a journaling implementation.

OverridesInheritanceBehavior

Gets or sets a value that indicates whether the property value inheritance evaluation should span across certain content boundaries in the logical tree of elements.

PropertyChangedCallback

Gets or sets a reference to a PropertyChangedCallback implementation specified in this metadata.

(Inherited from PropertyMetadata)
SubPropertiesDoNotAffectRender

Gets or sets a value that indicates whether sub-properties of the dependency property do not affect the rendering of the containing object.

Methods

Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetType()

Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
Merge(PropertyMetadata, DependencyProperty)

Enables a merge of the source metadata with base metadata.

OnApply(DependencyProperty, Type)

Called when this metadata has been applied to a property, which indicates that the metadata is being sealed.

ToString()

Returns a string that represents the current object.

(Inherited from Object)

Applies to

See also