PropertyMetadata 类

定义

定义依赖属性在应用于特定类型(包括该属性向其注册的条件)时行为的某些方面。Defines certain behavior aspects of a dependency property as it is applied to a specific type, including conditions it was registered with.

public ref class PropertyMetadata
public class PropertyMetadata
type PropertyMetadata = class
Public Class PropertyMetadata
继承
PropertyMetadata
派生

注解

调用Register方法时, 可以在依赖属性注册过程中定义和使用属性元数据 (或附加属性或只读依赖属性的变体), 或在调用OverrideMetadata方法。Property metadata can be defined and used during dependency property registration when calling the Register method (or variations for attached properties or read-only dependency properties), or after original owner registration when calling the OverrideMetadata method. AddOwner还使用属性元数据。AddOwner also takes property metadata.

此类是一个具体的基类, 可在每个调用中使用。This class is a concrete base class that can be used in each of these calls. 但是, 使用派生类之一 (如FrameworkPropertyMetadata) 指定元数据是很常见的。However, it is very common to specify metadata using one of the derived classes such as FrameworkPropertyMetadata. 这些派生类支持将更详细的元数据作为布尔属性值传递, 这对于检测或启用仅在WPFWPF框架级别实现的某些属性系统和布局行为很有用。These derived classes support more detailed metadata carried as Boolean property values, which are useful for either detecting or enabling some property system and layout behaviors that are only implemented at the WPFWPF framework level.

此类的多个属性是对对象模型的读写属性, 但只能在与属性系统操作 (如或Register OverrideMetadata) 中使用的实例之前写入。Several properties of this class are read-write to the object model, but can only be written prior to the instance being used in a property system operation such as Register or OverrideMetadata. 这些属性中的每一个都可能是由构造函数设置的, 但会Merge公开, 以便方法实现可以对其进行设置。Each of these properties could also have been set by the constructor but are exposed so that Merge method implementations can set them.

XAML 文本用法XAML Text Usage

此类型和此类型的成员通常不在中XAMLXAML使用。This type, and members of this type, are not typically used in XAMLXAML.

构造函数

PropertyMetadata()

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

PropertyMetadata(Object)

使用此元数据将应用于的依赖项对象的指定默认值,初始化 PropertyMetadata 类的新实例。Initializes a new instance of the PropertyMetadata class with a specified default value for the dependency property that this metadata will be applied to.

PropertyMetadata(Object, PropertyChangedCallback)

用指定的默认值和 PropertyMetadata 实现引用初始化 PropertyChangedCallback 类的新实例。Initializes a new instance of the PropertyMetadata class with the specified default value and PropertyChangedCallback implementation reference.

PropertyMetadata(Object, PropertyChangedCallback, CoerceValueCallback)

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

PropertyMetadata(PropertyChangedCallback)

用指定的 PropertyMetadata 实现引用初始化 PropertyChangedCallback 类的新实例。Initializes a new instance of the PropertyMetadata class with the specified PropertyChangedCallback implementation reference.

属性

CoerceValueCallback

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

DefaultValue

获取或设置依赖属性的默认值。Gets or sets the default value of the dependency property.

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.

PropertyChangedCallback

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

方法

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)

将此元数据与基元数据合并。Merges this metadata with the 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)

适用于