ValueSource 结构


报告从 GetValueSource(DependencyObject, DependencyProperty) 返回的信息。Reports the information returned from GetValueSource(DependencyObject, DependencyProperty).

public value class ValueSource
public struct ValueSource
type ValueSource = struct
Public Structure ValueSource


ValueSource 传输的大多数信息都包含在 BaseValueSource 属性中。Most of the information that ValueSource transmits is contained in the BaseValueSource property. 此属性包含一个枚举值,该枚举值仅指定负责依赖属性的有效值的总体 WPFWPF 属性系统的一个方面。This property contains an enumeration value that specifies exactly one aspect of the overall WPFWPF property system that is responsible for the effective value of a dependency property.

除基值外,有关依赖项属性值的其他信息,也就是该值是否正在进行动画处理,以及该值是否涉及表达式(如绑定或动态资源引用)。Besides the base value, the other information that might be interesting about a dependency property value is whether the value is being animated, and whether the value involves an expression (such as a binding, or a dynamic resource reference). 此信息分别 IsAnimatedIsExpression 报告。This information is reported by IsAnimated and IsExpression respectively. 此外,如果强制在属性值上操作,属性将保留所需的值,并且如果更改或提升特定强制的约束,则属性值将尝试访问该所需的值。Also, if coercion is acting on a property value, the property retains a desired value, and the property value will attempt to reach that desired value if the constraints of the specific coercion are changed or lifted. 不在其所需值的已强制属性将报告 IsCoercedtrue的。A coerced property that is not at its desired value will report that IsCoerced is true.



获取 BaseValueSource 枚举的值,该值报告向依赖项属性系统提供值的源。Gets a value of the BaseValueSource enumeration, which reports the source that provided the dependency property system with a value.


获取一个值,该值声明是否对属性进行动画处理。Gets a value that declares whether the property is being animated.


获取一个值,声明此值是否是从应用于依赖属性的 CoerceValueCallback 实现中生成的。Gets a value that declares whether this value resulted from a CoerceValueCallback implementation applied to a dependency property.


获取一个值,该值声明是否由 SetCurrentValue(DependencyProperty, Object) 方法设置值。Gets whether the value was set by the SetCurrentValue(DependencyProperty, Object) method.


获取一个值,声明此值是否是从计算的表达式中生成的。Gets a value that declares whether this value resulted from an evaluated expression. 此表达式可能是支持绑定的 BindingExpression,或者是一个内部表达式,比如支持 DynamicResource 标记扩展的那些表达式。This might be a BindingExpression supporting a binding, or an internal expression such as those that support the DynamicResource Markup Extension.



返回一个值,指示此 ValueSource 是否与指定对象相等。Returns a value indicating whether this ValueSource is equal to a specified object.


返回此 ValueSource 的哈希代码。Returns the hash code for this ValueSource.


Equality(ValueSource, ValueSource)

确定两个 ValueSource 实例是否具有相同的值。Determines whether two ValueSource instances have the same value.

Inequality(ValueSource, ValueSource)

确定两个 ValueSource 实例是否具有不同的值。Determines whether two ValueSource instances do not have the same value.