BindingManagerBase.Bindings 属性

定义

获取所管理绑定的集合。Gets the collection of bindings being managed.

public:
 property System::Windows::Forms::BindingsCollection ^ Bindings { System::Windows::Forms::BindingsCollection ^ get(); };
public System.Windows.Forms.BindingsCollection Bindings { get; }
member this.Bindings : System.Windows.Forms.BindingsCollection
Public ReadOnly Property Bindings As BindingsCollection

属性值

一个 BindingsCollection,它包含该 Binding 所管理的 BindingManagerBase 对象。A BindingsCollection that contains the Binding objects managed by this BindingManagerBase.

示例

下面的代码示例获取特定BindingManagerBase数据源的。The following code example gets the BindingManagerBase for a specific data source. 然后,该示例使用Bindings属性打印有关绑定到同一个数据源的每个控件的信息。The example then uses the Bindings property to print information about each control bound to the same data source.

void PrintBoundControls()
{
   BindingManagerBase^ myBindingBase = this->BindingContext[ ds,"customers" ];
   System::Collections::IEnumerator^ myEnum = myBindingBase->Bindings->GetEnumerator();
   while ( myEnum->MoveNext() )
   {
      Binding^ b = safe_cast<Binding^>(myEnum->Current);
      Console::WriteLine( b->Control );
   }
}

private void PrintBoundControls()
{
   BindingManagerBase myBindingBase = this.BindingContext[ds, "customers"];
   foreach(Binding b in myBindingBase.Bindings)
   {
      Console.WriteLine(b.Control.ToString());
   }
}

Private Sub PrintBoundControls()
    Dim myBindingBase As BindingManagerBase = Me.BindingContext(ds, "customers")
    Dim b As Binding
    For Each b In  myBindingBase.Bindings
        Console.WriteLine(b.Control.ToString())
    Next b
End Sub

适用于

另请参阅