Click to Rate and Give Feedback
MSDN
MSDN Library
.NET Development
Silverlight
System.Windows
 GetBindingExpression Method
Collapse All/Expand All Collapse All
.NET Framework Class Library for Silverlight
FrameworkElement..::.GetBindingExpression Method

Retrieves the BindingExpression for a dependency property where a binding is established.

Namespace:  System.Windows
Assembly:  System.Windows (in System.Windows.dll)
Visual Basic (Declaration)
Public Function GetBindingExpression ( _
    dp As DependencyProperty _
) As BindingExpression
C#
public BindingExpression GetBindingExpression(
    DependencyProperty dp
)

Parameters

dp
Type: System.Windows..::.DependencyProperty
The dependency property identifier for the specific property on this FrameworkElement where you want to obtain the BindingExpression.

Return Value

Type: System.Windows.Data..::.BindingExpression
A BindingExpression for the binding, if the local value represented a data-bound value. May return nullNothingnullptra null reference (Nothing in Visual Basic) if the property is not a data-bound value.

In the current implementation, this method returns the same result as ReadLocalValue, with the return value cast to BindingExpression.

You could potentially use GetBindingExpression as a test to see whether a given dependency property has a binding applied to it, by attempting the cast of the return value to BindingExpression. If this succeeds, the property is currently being set by a data-bound value. If the value is nullNothingnullptra null reference (Nothing in Visual Basic) rather than a BindingExpression, then the property you queried is not data-bound.

A BindingExpression object enables the following scenarios with its API:

For more information, see BindingExpression or Data Binding.

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2012 Microsoft. All rights reserved. Terms of Use | Trademarks | Privacy Statement
Page view tracker