FrameworkElement.GetBindingExpression(DependencyProperty) 方法

定义

返回表示指定属性的绑定的 BindingExpressionReturns the BindingExpression that represents the binding on the specified property.

public:
 System::Windows::Data::BindingExpression ^ GetBindingExpression(System::Windows::DependencyProperty ^ dp);
public System.Windows.Data.BindingExpression GetBindingExpression (System.Windows.DependencyProperty dp);
member this.GetBindingExpression : System.Windows.DependencyProperty -> System.Windows.Data.BindingExpression
Public Function GetBindingExpression (dp As DependencyProperty) As BindingExpression

参数

dp
DependencyProperty

要从中获取绑定的目标 DependencyPropertyThe target DependencyProperty to get the binding from.

返回

如果目标属性具有活动的绑定,则返回 BindingExpression;否则返回 nullA BindingExpression if the target property has an active binding; otherwise, returns null.

注解

检查 null 的返回值是一种技术,可用于确定属性是否具有活动绑定。Checking the return value for null is a technique you can use to determine whether a property has an active binding.

此方法实际上只是围绕 BindingOperations.GetBindingExpression 方法的便利包装。This method is really just a convenience wrapper around the BindingOperations.GetBindingExpression method. GetBindingExpression 将当前实例和 dp 参数传递给 BindingOperations.GetBindingExpressionGetBindingExpression passes the current instance and the dp parameter to BindingOperations.GetBindingExpression.

适用于

另请参阅