Binding.BindingMemberInfo 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
根據 Binding 建構函式中的 dataMember
參數,取得包含這個繫結之相關資訊的物件。
public:
property System::Windows::Forms::BindingMemberInfo BindingMemberInfo { System::Windows::Forms::BindingMemberInfo get(); };
public System.Windows.Forms.BindingMemberInfo BindingMemberInfo { get; }
member this.BindingMemberInfo : System.Windows.Forms.BindingMemberInfo
Public ReadOnly Property BindingMemberInfo As BindingMemberInfo
屬性值
BindingMemberInfo,包含關於這個 Binding 的資訊。
範例
下列程式碼範例會取得 BindingMemberInfo 表單上每個 Binding 的 ,並列印 BindingPath 該 Binding 的 、 BindingField 和 BindingMember 屬性值。
private:
void PrintBindingMemberInfo()
{
for each ( Control^ thisControl in this->Controls)
{
for each ( Binding^ thisBinding in thisControl->DataBindings)
{
// Print the control's name and Binding information.
Console::WriteLine( "\n {0}", thisControl );
BindingMemberInfo bInfo = thisBinding->BindingMemberInfo;
Console::WriteLine( "Binding Path \t {0}", bInfo.BindingPath );
Console::WriteLine( "Binding Field \t {0}", bInfo.BindingField );
Console::WriteLine( "Binding Member \t {0}", bInfo.BindingMember );
}
}
}
private void PrintBindingMemberInfo()
{
foreach(Control thisControl in this.Controls)
{
foreach(Binding thisBinding in thisControl.DataBindings)
{
// Print the control's name and Binding information.
Console.WriteLine("\n" + thisControl.ToString());
BindingMemberInfo bInfo = thisBinding.BindingMemberInfo;
Console.WriteLine("Binding Path \t" + bInfo.BindingPath);
Console.WriteLine("Binding Field \t" + bInfo.BindingField);
Console.WriteLine("Binding Member \t" + bInfo.BindingMember);
}
}
}
Private Sub PrintBindingMemberInfo()
Dim thisControl As Control
For Each thisControl In Me.Controls
Dim thisBinding As Binding
For Each thisBinding In thisControl.DataBindings
' Print the control's name and Binding information.
Console.WriteLine(ControlChars.Cr + thisControl.ToString())
Dim bInfo As BindingMemberInfo = thisBinding.BindingMemberInfo
Console.WriteLine("Binding Path " + ControlChars.Tab _
+ bInfo.BindingPath)
Console.WriteLine("Binding Field " + ControlChars.Tab _
+ bInfo.BindingField)
Console.WriteLine("Binding Member " + ControlChars.Tab _
+ bInfo.BindingMember)
Next thisBinding
Next thisControl
End Sub
備註
BindingMemberInfo會從傳遞至建構函式的 dataMember
Binding 字串建立 。