BindingMemberInfo.BindingField 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
取得資料繫結物件的屬性名稱。
public:
property System::String ^ BindingField { System::String ^ get(); };
public string BindingField { get; }
member this.BindingField : string
Public ReadOnly Property BindingField As String
屬性值
資料繫結物件的屬性名稱。 這個值不能是空字串 ("")。
範例
下列程式碼範例會取得 BindingMemberInfo 表單上每個 Binding 的 ,並列印 BindingPath 的 、 BindingField 和 BindingMember 屬性值 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
備註
BindingField是 屬性所 BindingMember 傳回之導覽路徑中最後一個專案。 例如,如果建立新的 Binding ,且其參數為 dataMember
「Customers.custToOrders.OrderDate」, BindingMember 將會傳回 「OrderDate」。