BindingOperations::GetBindingExpression Method

Returns the BindingExpression object associated with the specified binding target property on the specified object.

Namespace:  System.Windows.Data
Assembly:  PresentationFramework (in PresentationFramework.dll)

public:
static BindingExpression^ GetBindingExpression(
	DependencyObject^ target, 
	DependencyProperty^ dp
)

Parameters

target
Type: System.Windows::DependencyObject

The binding target object where dp is.

dp
Type: System.Windows::DependencyProperty

The binding target property from which to retrieve the BindingExpression object.

Return Value

Type: System.Windows.Data::BindingExpression
The BindingExpression object associated with the given property or nullptr if none exists. If a PriorityBindingExpression object is set on the property, the ActiveBindingExpression is returned.

ExceptionCondition
ArgumentNullException

The target and dp parameters cannot be nullptr.

The BindingExpression object maintains the connection between the binding source and the binding target. You can obtain the BindingExpression object by calling this static method or by calling the GetBindingExpression method on a data-bound FrameworkElement or FrameworkContentElement object.

The following example shows the implementation of a Click event handler that uses the GetBindingExpression method to obtain the BindingExpression and then calls the DataItem property to access the binding source object.

The TextBlock SavingsText is the binding target object and Text is the binding target property.

No code example is currently available or this language may not be supported.

.NET Framework

Supported in: 4.5, 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft