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. ABinding包含可以跨數個共用的所有資訊BindingExpression物件。A Binding contains all the information that can be shared across several BindingExpression objects. ABindingExpression執行個體運算式無法共用,並包含所有執行個體的資訊關於BindingA BindingExpression is an instance expression that cannot be shared and that contains all the instance information about the Binding.

例如,請考慮下列項目,其中myDataObject的執行個體MyData類別,myBinding是來源Binding物件,並MyData類別是定義的類別,其中包含字串屬性,名為MyDataPropertyFor 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,這是執行個體TextBlockMyDataPropertyThis 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.

您可以取得BindingExpression使用的物件GetBindingExpression方法或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

取得這個繫結運算式所屬的 BindingGroupGets 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 的淺層複本 (Shallow Copy)。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 屬性已設為 BindingValidationStep 的相關聯 RawProposedValue 上,執行任何 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.

適用於