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.

例如, 請考慮myDataObject下列各MyData項, 其中是類別的實例、 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實例) 系MyDataProperty結至。This 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.

適用於