Binding.IsBinding 属性
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取指示绑定是否活动的值。
public:
property bool IsBinding { bool get(); };
public bool IsBinding { get; }
member this.IsBinding : bool
Public ReadOnly Property IsBinding As Boolean
属性值
如果绑定处于活动状态,为 true
;否则为 false
。
示例
下面的代码示例打印PropertyName窗体上每个Binding的 和 IsBinding 值。
private:
void PrintBindingIsBinding()
{
for each ( Control^ c in this->Controls )
{
for each ( Binding^ b in c->DataBindings )
{
Console::WriteLine( "\n {0}", c );
Console::WriteLine( "{0} IsBinding: {1}",
b->PropertyName, b->IsBinding );
}
}
}
private void PrintBindingIsBinding()
{
foreach(Control c in this.Controls)
{
foreach(Binding b in c.DataBindings)
{
Console.WriteLine("\n" + c.ToString());
Console.WriteLine(b.PropertyName + " IsBinding: "
+ b.IsBinding);
}
}
}
Private Sub PrintBindingIsBinding
Dim c As Control
Dim b As Binding
For Each c In Me.Controls
For Each b in c.DataBindings
Console.WriteLine (ControlChars.CrLf & c.ToString)
Console.WriteLine (b.PropertyName & " IsBinding: " & _
b.IsBinding)
Next
Next
End Sub
注解
绑定满足以下条件时处于活动状态:
已设置其所有属性。
用户未在 所属的 Binding 上BindingManagerBase调用 ResumeBinding 或 SuspendBinding 。
已创建 所属的 控件 Binding 。