ValueSource.IsExpression 属性

定义

获取一个值,声明此值是否是从计算的表达式中生成的。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.

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

属性值

如果值来自于计算出的表达式,则为 true;否则为 falsetrue if the value came from an evaluated expression; otherwise, false.

注解

计算后的表达式还将报告应用了表达式的特定基准值设置条件, 作为中BaseValueSource的值。An evaluated expression will also report the specific base value setting condition where the expression was applied, as a value in BaseValueSource. 对于任何属性, IsExpression true它仍非常相关, 其中为。 BaseValueSourceThe BaseValueSource is still very relevant for any property where IsExpression is true. 如果值是间接设置的 (如通过模板或继承的属性值进行设置), 了解值是否通过表达式会特别有用。Knowing whether a value came through an expression can be particularly useful if the value was set indirectly, such as through a template or an inherited property value.

如果表达式无法计算 (绑定失败, 找不到该名称的资源), 则值将来自属性系统中的其他某个参与者, 这很可能是默认值。If an expression fails to evaluate (the binding failed; no resource of that name was found), then the value will come from some other participant in the property system, most likely the default value. 然后, 将在中BaseValueSource报告该源。That source is then reported in BaseValueSource. 失败的表达式评估将falseIsExpression返回。Failed expression evaluations will return false for IsExpression.

适用于

另请参阅