FrameworkElement.GetBindingExpression(DependencyProperty) 方法

定义

返回表示指定属性的绑定的 BindingExpression

C#
public System.Windows.Data.BindingExpression GetBindingExpression(System.Windows.DependencyProperty dp);

参数

dp
DependencyProperty

要从中获取绑定的目标 DependencyProperty

返回

如果目标属性具有活动的绑定,则返回 BindingExpression;否则返回 null

注解

检查 的 null 返回值是一种可用于确定属性是否具有活动绑定的技术。

此方法实际上只是围绕 方法的 BindingOperations.GetBindingExpression 便捷包装器。 GetBindingExpression 将当前 实例和 dp 参数传递给 BindingOperations.GetBindingExpression

适用于

产品 版本
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10

另请参阅