共用方式為


BindingMemberInfo.BindingPath 屬性

定義

取得屬性名稱,或位在資料繫結物件之屬性名稱前以句號分隔的屬性名稱階層架構。

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

屬性值

屬性名稱,或位在資料繫結物件屬性名稱前以句號分隔的屬性名稱階層架構。

範例

下列程式碼範例會取得 BindingMemberInfo 表單上每個 Binding 的 ,並列印 BindingPath 的 、 BindingFieldBindingMember 屬性值 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

備註

BindingPath是 屬性傳回 BindingMember 之導覽路徑中 之前 BindingField 的屬性名稱句點分隔組合。 例如,建立新的 Binding 時,其參數為 dataMember 「Customers.custToOrders.OrderDate」, BindingPath 將會傳回 「Customers.custToOrders」。

適用於

另請參閱