BindingManagerBase.Bindings 属性

获取所管理绑定的集合。

**命名空间:**System.Windows.Forms
**程序集:**System.Windows.Forms(在 system.windows.forms.dll 中)

语法

声明
Public ReadOnly Property Bindings As BindingsCollection
用法
Dim instance As BindingManagerBase
Dim value As BindingsCollection

value = instance.Bindings
public BindingsCollection Bindings { get; }
public:
property BindingsCollection^ Bindings {
    BindingsCollection^ get ();
}
/** @property */
public BindingsCollection get_Bindings ()
public function get Bindings () : BindingsCollection

属性值

一个 BindingsCollection,它包含该 BindingManagerBase 所管理的 Binding 对象。

示例

下面的代码示例获取特定数据源的 BindingManagerBase。然后示例使用 Bindings 属性输出有关绑定到同一数据源的每个控件的信息。

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 'PrintBoundControls
private void PrintBoundControls()
{
   BindingManagerBase myBindingBase = this.BindingContext[ds, "customers"];
   foreach(Binding b in myBindingBase.Bindings)
   {
      Console.WriteLine(b.Control.ToString());
   }
}
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.get_BindingContext().
        get_Item(ds, "customers");
    for (int iCtr = 0; iCtr < myBindingBase.get_Bindings().get_Count(); 
        iCtr++) {
        Binding b = myBindingBase.get_Bindings().get_Item(iCtr);
        Console.WriteLine(b.get_Control().ToString());
    }
} //PrintBoundControls

平台

Windows 98、Windows 2000 SP4、Windows CE、Windows Millennium Edition、Windows Mobile for Pocket PC、Windows Mobile for Smartphone、Windows Server 2003、Windows XP Media Center Edition、Windows XP Professional x64 Edition、Windows XP SP2、Windows XP Starter Edition

.NET Framework 并不是对每个平台的所有版本都提供支持。有关受支持版本的列表,请参见系统要求

版本信息

.NET Framework

受以下版本支持:2.0、1.1、1.0

.NET Compact Framework

受以下版本支持:2.0、1.0

请参见

参考

BindingManagerBase 类
BindingManagerBase 成员
System.Windows.Forms 命名空间
Binding 类
BindingContext 类
SuspendBinding
ResumeBinding
UpdateIsBinding
BindingComplete