BindingExpression BindingExpression BindingExpression BindingExpression Class

定义

包含有关 Binding 的单个实例的信息。Contains information about a single instance of a Binding.

public ref class BindingExpression sealed : System::Windows::Data::BindingExpressionBase, System::Windows::IWeakEventListener
public sealed class BindingExpression : System.Windows.Data.BindingExpressionBase, System.Windows.IWeakEventListener
type BindingExpression = class
    inherit BindingExpressionBase
    interface IWeakEventListener
Public NotInheritable Class BindingExpression
Inherits BindingExpressionBase
Implements IWeakEventListener
继承
实现

注解

Binding类是绑定的声明的高级类。The Binding class is the high-level class for the declaration of a binding. BindingExpression类是维护绑定源和绑定目标之间的连接的基础对象。The BindingExpression class is the underlying object that maintains the connection between the binding source and the binding target. 包含可在多个BindingExpression对象之间共享的所有信息。 BindingA Binding contains all the information that can be shared across several BindingExpression objects. 是无法共享的实例表达式, 它包含有关的Binding所有实例信息。 BindingExpressionA BindingExpression is an instance expression that cannot be shared and that contains all the instance information about the Binding.

例如, 请考虑以下情况, 其中myDataObjectMyData类的一个实例, myBinding是源Binding对象, MyData类是一个定义的类, 其中包含一个名为MyDataProperty的字符串属性。For example, consider the following, where myDataObject is an instance of the MyData class, myBinding is the source Binding object, and MyData class is a defined class that contains a string property named MyDataProperty. 此示例将 (的mytext TextBlock实例) 的文本内容绑定到MyDataPropertyThis example binds the text content of mytext, which is an instance of TextBlock, to MyDataProperty.

// Make a new source.
MyData myDataObject = new MyData(DateTime.Now);      
Binding myBinding = new Binding("MyDataProperty");
myBinding.Source = myDataObject;
// Bind the new data source to the myText TextBlock control's Text dependency property.
myText.SetBinding(TextBlock.TextProperty, myBinding);
' Make a new source.
Dim data1 As New MyData(DateTime.Now)
Dim binding1 As New Binding("MyDataProperty")
binding1.Source = data1
' Bind the new data source to the myText TextBlock control's Text dependency property.
Me.myText.SetBinding(TextBlock.TextProperty, binding1)

您可以使用相同myBinding的对象创建其他绑定。You can use the same myBinding object to create other bindings. 例如, 您可以使用myBinding对象将复选框的文本内容绑定到。 MyDataPropertyFor example, you might use the myBinding object to bind the text content of a check box to MyDataProperty. 在这种情况下, 将有两个BindingExpression myBinding共享对象的实例。In that scenario, there will be two instances of BindingExpression that share the myBinding object.

您可以通过GetBindingExpression使用BindingExpression方法或数据绑定对象上的GetBindingExpression方法来获取对象。You can obtain a BindingExpression object by using the GetBindingExpression method or the GetBindingExpression method on a data-bound object.

属性

BindingGroup BindingGroup BindingGroup BindingGroup

获取此 BindingGroup 绑定表达式所属的轴。Gets the BindingGroup that this binding expression belongs to.

(Inherited from BindingExpressionBase)
DataItem DataItem DataItem DataItem

获取此 BindingExpression 使用的绑定源对象。Gets the binding source object that this BindingExpression uses.

HasError HasError HasError HasError

获取一个值,该值指示父绑定是否具有一个失败的验证规则。Gets a value that indicates whether the parent binding has a failed validation rule.

(Inherited from BindingExpressionBase)
HasValidationError HasValidationError HasValidationError HasValidationError

获取一个值,该值指示父绑定是否具有一个失败的验证规则。Gets a value that indicates whether the parent binding has a failed validation rule.

(Inherited from BindingExpressionBase)
IsDirty IsDirty IsDirty IsDirty

获取或设置指示绑定目标是否包含尚未写入到源中的值的值。Gets or sets a value that indicates whether the target of the binding has a value that has not been written to the source.

(Inherited from BindingExpressionBase)
ParentBinding ParentBinding ParentBinding ParentBinding

返回当前 BindingExpressionBinding 对象。Returns the Binding object of the current BindingExpression.

ParentBindingBase ParentBindingBase ParentBindingBase ParentBindingBase

获取从中创建此 BindingBase 对象的 BindingExpressionBase 对象。Gets the BindingBase object from which this BindingExpressionBase object is created.

(Inherited from BindingExpressionBase)
ResolvedSource ResolvedSource ResolvedSource ResolvedSource

获取该 BindingExpression 的绑定源对象。Gets the binding source object for this BindingExpression.

ResolvedSourcePropertyName ResolvedSourcePropertyName ResolvedSourcePropertyName ResolvedSourcePropertyName

获取BindingExpression 的获取绑定源属性的名称。Gets the name of the binding source property for this BindingExpression.

Status Status Status Status

获取绑定表达式的状态。Gets the status of the binding expression.

(Inherited from BindingExpressionBase)
Target Target Target Target

获取该绑定表达式的绑定目标对象元素。Gets the element that is the binding target object of this binding expression.

(Inherited from BindingExpressionBase)
TargetProperty TargetProperty TargetProperty TargetProperty

获取此绑定表达式的绑定目标属性。Gets the binding target property of this binding expression.

(Inherited from BindingExpressionBase)
ValidationError ValidationError ValidationError ValidationError

获取导致 ValidationError 的此实例无效的 BindingExpressionBaseGets the ValidationError that caused this instance of BindingExpressionBase to be invalid.

(Inherited from BindingExpressionBase)
ValidationErrors ValidationErrors ValidationErrors ValidationErrors

获取导致 ValidationError 实例无效的 BindingExpressionBase 集合。Gets a collection of ValidationError objects that caused this instance of BindingExpressionBase to be invalid.

(Inherited from BindingExpressionBase)

方法

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

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

(Inherited from Object)
GetHashCode() GetHashCode() GetHashCode() GetHashCode()

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

(Inherited from Object)
GetType() GetType() GetType() GetType()

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

(Inherited from Object)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

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

(Inherited from Object)
ToString() ToString() ToString() ToString()

返回表示当前对象的字符串。Returns a string that represents the current object.

(Inherited from Object)
UpdateSource() UpdateSource() UpdateSource() UpdateSource()

将当前绑定目标值发送到 TwoWayOneWayToSource 绑定中的绑定源属性。Sends the current binding target value to the binding source property in TwoWay or OneWayToSource bindings.

UpdateTarget() UpdateTarget() UpdateTarget() UpdateTarget()

强制将数据从绑定源属性传输到绑定目标属性。Forces a data transfer from the binding source property to the binding target property.

ValidateWithoutUpdate() ValidateWithoutUpdate() ValidateWithoutUpdate() ValidateWithoutUpdate()

对关联的 ValidationRule 运行 Binding 属性设置为 ValidationStepRawProposedValue 的任何 ConvertedProposedValue 对象。Runs any ValidationRule objects on the associated Binding that have the ValidationStep property set to RawProposedValue or ConvertedProposedValue. 此方法不更新源。This method does not update the source.

(Inherited from BindingExpressionBase)

显式界面实现

IWeakEventListener.ReceiveWeakEvent(Type, Object, EventArgs) IWeakEventListener.ReceiveWeakEvent(Type, Object, EventArgs) IWeakEventListener.ReceiveWeakEvent(Type, Object, EventArgs) IWeakEventListener.ReceiveWeakEvent(Type, Object, EventArgs)

此成员支持 Windows Presentation Foundation (WPF)Windows Presentation Foundation (WPF) 基础结构,但不能在代码中直接使用。This member supports the Windows Presentation Foundation (WPF)Windows Presentation Foundation (WPF) infrastructure and is not intended to be used directly from your code.

适用于