Binding​Expression Class

Definition

Contains information about a single instance of a Binding.

public sealed class BindingExpression : System.Windows.Data.BindingExpressionBase, System.Windows.IWeakEventListener
Inheritance
Implements

Inherited Members

System.Object

System.Windows.Data.BindingExpressionBase

Remarks

The Binding class is the high-level class for the declaration of a binding. The BindingExpression class is the underlying object that maintains the connection between the binding source and the binding target. A Binding contains all the information that can be shared across several BindingExpression objects. A BindingExpression is an instance expression that cannot be shared and that contains all the instance information about the Binding.

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. 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;
  myText.SetBinding(TextBlock.TextProperty, myBinding);
Dim data1 As New MyData(DateTime.Now)
Dim binding1 As New Binding("MyDataProperty")
binding1.Source = data1
Me.myText.SetBinding(TextBlock.TextProperty, binding1)

You can use the same myBinding object to create other bindings. For example, you might use the myBinding object to bind the text content of a check box to MyDataProperty. In that scenario, there will be two instances of BindingExpression that share the myBinding object.

You can obtain a BindingExpression object by using the GetBindingExpression method or the GetBindingExpression method on a data-bound object.

Properties

Data​Item

Gets the binding source object that this BindingExpression uses.

Parent​Binding

Returns the Binding object of the current BindingExpression.

Resolved​Source

Gets the binding source object for this BindingExpression.

Resolved​Source​Property​Name

Gets the name of the binding source property for this BindingExpression.

Methods

Update​Source()

Sends the current binding target value to the binding source property in TwoWay or OneWayToSource bindings.

Update​Target()

Forces a data transfer from the binding source property to the binding target property.

Explicit Interface Implementations

I​Weak​Event​Listener.​Receive​Weak​Event(​Type, ​Object, ​Event​Args)

This member supports the Windows Presentation Foundation (WPF) infrastructure and is not intended to be used directly from your code.