BindingMemberInfo.BindingMember 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
取得資訊,用於指定資料繫結物件的屬性名稱。
public:
property System::String ^ BindingMember { System::String ^ get(); };
public string BindingMember { get; }
member this.BindingMember : string
Public ReadOnly Property BindingMember 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
備註
BindingMemberInfo當您使用 control-property name、資料來源和導覽路徑呼叫 BindingMemberInfo 建構函式時,會自動建立 。 參數 dataMember
包含 BindingMember 字串。
BindingMember是 和 BindingField 值的句點分隔組合 BindingPath 。 例如,使用 dataMember
「Customers.custToOrders.OrderDate」 的參數建立新的 Binding 時, BindingMember 會傳回 「Customers.custToOrders.OrderDate」。