BindingExpression クラス

定義

Bindingの 1 つのインスタンスに関する情報を格納します。

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 クラスは、バインディングの宣言の高レベル クラスです。 BindingExpression クラスは、バインディング ソースとバインディング ターゲットの間の接続を維持する基になるオブジェクトです。 Bindingには、複数のBindingExpression オブジェクト間で共有できるすべての情報が含まれています。 BindingExpressionは、共有できず、Bindingに関するすべてのインスタンス情報を含むインスタンス式です。

たとえば、 myDataObjectMyData クラスのインスタンスである場合、 myBinding はソース Binding オブジェクトであり、 MyData クラスは MyDataProperty という名前の文字列プロパティを含む定義済みのクラスであるとします。 次の使用例は、TextBlockのインスタンスであるmytextのテキスト コンテンツを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 オブジェクトを使用して、他のバインドを作成できます。 たとえば、 myBinding オブジェクトを使用して、チェック ボックスのテキスト コンテンツを MyDataPropertyにバインドできます。 そのシナリオでは、myBinding オブジェクトを共有するBindingExpressionのインスタンスが 2 つあります。

BindingExpression オブジェクトは、データ バインド オブジェクトの GetBindingExpression メソッドまたは GetBindingExpression メソッドを使用して取得できます。

プロパティ

名前 説明
BindingGroup

このバインド式が属する BindingGroup を取得します。

(継承元 BindingExpressionBase)
DataItem

この BindingExpression が使用するバインディング ソース オブジェクトを取得します。

HasError

親バインドに失敗した検証規則があるかどうかを示す値を取得します。

(継承元 BindingExpressionBase)
HasValidationError

親バインドに失敗した検証規則があるかどうかを示す値を取得します。

(継承元 BindingExpressionBase)
IsDirty

バインディングのターゲットに、ソースに書き込まれていない値があるかどうかを示す値を取得または設定します。

(継承元 BindingExpressionBase)
ParentBinding

現在のBindingExpressionBinding オブジェクトを返します。

ParentBindingBase

このBindingBase オブジェクトの作成元となるBindingExpressionBase オブジェクトを取得します。

(継承元 BindingExpressionBase)
ResolvedSource

この BindingExpressionのバインディング ソース オブジェクトを取得します。

ResolvedSourcePropertyName

この BindingExpressionのバインディング ソース プロパティの名前を取得します。

Status

バインド式の状態を取得します。

(継承元 BindingExpressionBase)
Target

このバインド式のバインディング ターゲット オブジェクトである要素を取得します。

(継承元 BindingExpressionBase)
TargetProperty

このバインド式のバインド ターゲット プロパティを取得します。

(継承元 BindingExpressionBase)
ValidationError

このValidationErrorのインスタンスが無効になる原因となったBindingExpressionBaseを取得します。

(継承元 BindingExpressionBase)
ValidationErrors

このValidationErrorのインスタンスが無効になる原因となったBindingExpressionBase オブジェクトのコレクションを取得します。

(継承元 BindingExpressionBase)

メソッド

名前 説明
Equals(Object)

指定したオブジェクトが現在のオブジェクトと等しいかどうかを判断します。

(継承元 Object)
GetHashCode()

既定のハッシュ関数として機能します。

(継承元 Object)
GetType()

現在のインスタンスの Type を取得します。

(継承元 Object)
MemberwiseClone()

現在の Objectの簡易コピーを作成します。

(継承元 Object)
ToString()

現在のオブジェクトを表す文字列を返します。

(継承元 Object)
UpdateSource()

現在のバインディング ターゲット値を、 TwoWay または OneWayToSource バインドのバインディング ソース プロパティに送信します。

UpdateTarget()

バインディング ソース プロパティからバインディング ターゲット プロパティへのデータ転送を強制します。

ValidateWithoutUpdate()

ValidationRule プロパティがBindingまたはValidationStepに設定されている、関連付けられているRawProposedValueConvertedProposedValue オブジェクトを実行します。 このメソッドはソースを更新しません。

(継承元 BindingExpressionBase)

明示的なインターフェイスの実装

名前 説明
IWeakEventListener.ReceiveWeakEvent(Type, Object, EventArgs)

このメンバーは、Windows Presentation Foundation (WPF) インフラストラクチャをサポートしており、コードから直接使用するためのものではありません。

適用対象