FrameworkPropertyMetadata 类

定义

为依赖属性报告或应用元数据(从而专门添加特定于框架的属性系统特征)。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
继承
FrameworkPropertyMetadata

示例

下面的示例获取特定所有者作为初始基类型的依赖项属性的元数据 PropertyMetadataThe following example gets metadata for a dependency property on a particular owner as the initial base PropertyMetadata type. 该元数据强制转换为 FrameworkPropertyMetadataThat metadata is cast to FrameworkPropertyMetadata. 如果强制转换返回了有效的 FrameworkPropertyMetadata ,则 FrameworkPropertyMetadata 通过简单的 UI 报告不同的属性值 (不) 显示。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")

注解

此类派生自 PropertyMetadata) (UIPropertyMetadataThis class derives from PropertyMetadata (through UIPropertyMetadata) . 对于大多数 WPF 框架级别的应用程序开发目的, FrameworkPropertyMetadata 是用于依赖项属性元数据的类型,而不是基元数据类型 PropertyMetadataUIPropertyMetadataFor 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.

此类声明的用于补充基类的成员 PropertyMetadata 包括各种指定或报告 WPF 框架级别属性系统行为(如属性继承、数据绑定和布局)的布尔属性。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.

用于创建实例的多个构造函数签名 FrameworkPropertyMetadata 采用一个 FrameworkPropertyMetadataOptions 参数。Several constructor signatures for creating a FrameworkPropertyMetadata instance take a FrameworkPropertyMetadataOptions parameter. FrameworkPropertyMetadataOptions枚举仅用于指定构造函数中的初始行为,并在构造后不公开 FrameworkPropertyMetadataThe 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 文本用法XAML Text Usage

此类通常不在 XAML 中使用。This class is not typically used in XAML.

构造函数

FrameworkPropertyMetadata()

初始化 FrameworkPropertyMetadata 类的新实例。Initializes a new instance of the FrameworkPropertyMetadata class.

FrameworkPropertyMetadata(Object)

使用指定的默认值初始化 FrameworkPropertyMetadata 类的新实例。Initializes a new instance of the FrameworkPropertyMetadata class with the specified default value.

FrameworkPropertyMetadata(Object, FrameworkPropertyMetadataOptions)

使用提供的默认值和框架级别的元数据选项初始化 FrameworkPropertyMetadata 类的新实例。Initializes a new instance of the FrameworkPropertyMetadata class with the provided default value and framework-level metadata options.

FrameworkPropertyMetadata(Object, FrameworkPropertyMetadataOptions, PropertyChangedCallback)

使用提供的默认值和框架元数据选项及指定的 FrameworkPropertyMetadata 回调初始化 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, PropertyChangedCallback, CoerceValueCallback)

使用提供的默认值和框架元数据选项及指定的回调初始化 FrameworkPropertyMetadata 类的新实例。Initializes a new instance of the FrameworkPropertyMetadata class with the provided default value and framework metadata options, and specified callbacks.

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

使用提供的默认值和框架元数据选项、指定的回调及可以用来防止属性动画的布尔值初始化 FrameworkPropertyMetadata 类的新实例。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, Boolean, UpdateSourceTrigger)

使用提供的默认值和框架元数据选项、指定的回调、可以用来防止属性动画的布尔值及数据绑定更新触发器默认值初始化 FrameworkPropertyMetadata 类的新实例。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, PropertyChangedCallback)

使用提供的默认值和指定的 FrameworkPropertyMetadata 回调初始化 PropertyChangedCallback 类的新实例。Initializes a new instance of the FrameworkPropertyMetadata class with the provided default value and specified PropertyChangedCallback callback.

FrameworkPropertyMetadata(Object, PropertyChangedCallback, CoerceValueCallback)

使用提供的默认值和指定的回调初始化 FrameworkPropertyMetadata 类的新实例。Initializes a new instance of the FrameworkPropertyMetadata class with the provided default value and specified callbacks.

FrameworkPropertyMetadata(PropertyChangedCallback)

用指定的 FrameworkPropertyMetadata 回调初始化 PropertyChangedCallback 类的新实例。Initializes a new instance of the FrameworkPropertyMetadata class with the specified PropertyChangedCallback callback.

FrameworkPropertyMetadata(PropertyChangedCallback, CoerceValueCallback)

用指定的回调初始化 FrameworkPropertyMetadata 类的新实例。Initializes a new instance of the FrameworkPropertyMetadata class with the specified callbacks.

属性

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

获取或设置对此元数据中所指定 CoerceValueCallback 实现的引用。Gets or sets a reference to a CoerceValueCallback implementation specified in this metadata.

(继承自 PropertyMetadata)
DefaultUpdateSourceTrigger

获取或设置在应用具有该元数据的属性的绑定时要使用的 UpdateSourceTrigger 的默认值,这些绑定的 UpdateSourceTrigger 设置为 DefaultGets 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.

(继承自 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.

(继承自 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.

(继承自 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

获取或设置对此元数据中所指定 PropertyChangedCallback 实现的引用。Gets or sets a reference to a PropertyChangedCallback implementation specified in this metadata.

(继承自 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.

方法

Equals(Object)

确定指定对象是否等于当前对象。Determines whether the specified object is equal to the current object.

(继承自 Object)
GetHashCode()

作为默认哈希函数。Serves as the default hash function.

(继承自 Object)
GetType()

获取当前实例的 TypeGets the Type of the current instance.

(继承自 Object)
MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(继承自 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.

(继承自 Object)

适用于

另请参阅