BindingMemberInfo.BindingMember 属性

定义

获取用于指定数据绑定对象的属性名的信息。

public:
 property System::String ^ BindingMember { System::String ^ get(); };
public string BindingMember { get; }
member this.BindingMember : string
Public ReadOnly Property BindingMember As String

属性值

String

解析为最终数据绑定对象的属性名的空字符串 ("")、单个属性名或句点分隔的属性名层次结构。

示例

The following code example gets the BindingMemberInfo object of each Binding on a form, and prints the BindingPath, BindingField, and BindingMember property values of BindingMemberInfo.

private:
   void PrintBindingMemberInfo()
   {
      Console::WriteLine( "\n BindingMemberInfo" );
      for each ( Control^ thisControl in this->Controls )
      {
         for each ( Binding^ thisBinding in thisControl->DataBindings )
         {
            BindingMemberInfo bInfo = thisBinding->BindingMemberInfo;
            Console::WriteLine( "\t BindingPath: {0}", bInfo.BindingPath );
            Console::WriteLine( "\t BindingField: {0}", bInfo.BindingField );
            Console::WriteLine( "\t BindingMember: {0}", bInfo.BindingMember );
            Console::WriteLine();
         }
      }
   }
private void PrintBindingMemberInfo()
{
   Console.WriteLine("\n BindingMemberInfo");
   foreach(Control thisControl in this.Controls)
   {
      foreach(Binding thisBinding in thisControl.DataBindings)
      {
         BindingMemberInfo bInfo = thisBinding.BindingMemberInfo;
         Console.WriteLine("\t BindingPath: " + bInfo.BindingPath);
         Console.WriteLine("\t BindingField: " + bInfo.BindingField);
         Console.WriteLine("\t BindingMember: " + 
         bInfo.BindingMember);
         Console.WriteLine();
      }   
   }
}
Private Sub PrintBindingMemberInfo()
   Console.WriteLine(ControlChars.Cr + " BindingMemberInfo")
   Dim thisControl As Control
   Dim thisBinding As Binding
   For Each thisControl In  Me.Controls    
      For Each thisBinding In  thisControl.DataBindings
         Dim bInfo As BindingMemberInfo =  _
         thisBinding.BindingMemberInfo
         Console.WriteLine(ControlChars.Tab + _
         " BindingPath: "  + bInfo.BindingPath)
         Console.WriteLine(ControlChars.Tab + _
         " BindingField: " + bInfo.BindingField)
         Console.WriteLine(ControlChars.Tab + _
         " BindingMember: "  + bInfo.BindingMember)
         Console.WriteLine()
      Next thisBinding
   Next thisControl
End Sub

注解

调用控件属性名称、数据源和导航路径的BindingMemberInfo构造函数时,会自动创建 ABindingMemberInfo。 该 dataMember 参数包含 BindingMember 字符串。

BindingMember 句点分隔的组合 BindingPathBindingField 值。 例如,使用dataMember“Customers.custToOrders.OrderDate”参数创建新项时BindingBindingMember将返回“Customers.custToOrders.OrderDate”。

适用于

另请参阅