原文在此:http://www.codeproject.com/Articles/24656/A-Detailed-Data-Binding-Tutorialhtml
完整譯文在此:http://www.cnblogs.com/lichence/archive/2012/02/17/2356001.html數據庫
譯不下去的筆記在此:編碼
System.Windows.Forms.BindingSource是2.0裏邊的一個新類。趕腳微軟想用BindingSource取代之前的CurrencyManager和BindingContext,因此本篇就只講講BingdingSource。code
首先:orm
so,DataSource究竟是幹嗎的?……在現實編碼中,一般用BindingSource實例做爲Bindings對象們的DataSource屬性的值,Binddings[x].DataSource is BindingSource。htm
若是你用數據庫,那麼這個BindingSource.DataSource一般是DataSet,若是不用數據庫,那它極可能是一個自定義類的實例。對象
使用data binding的方法千千萬,最經常使用之一:給一個Control的DataSource綁一個BindingSource對象。 blog
能夠認爲BindingSource是一個二合一的數據源。二合一一般意味着: 事件
控件不一樣數據綁定的方式也有不一樣: ip
* grid什麼的它們的DataBindings屬性,即便有東西,也是無用的。這個要注意。
再簡化一下也就是兩種綁定方式,一個是經過Control.DataSource=,一個是Control.DataBindings.Add()。
經常使用於綁定的屬性包括:
Tips: ListView和TreeView的內容是不能綁定的(天怒人怨),它的SelectIndex和Enable這樣的屬性能夠綁定。(天怒人怨)
……
•The latter handler (Binding.Target_Validate) passes the new value through a couple of internal classes, BindToObject and ReflectPropertyDescriptor, the latter of which uses Reflection to actually change the value in the Airplane and then call base.OnValueChanged in its base class, PropertyDescriptor.
這裏貌似是講到TextBox的Validate事件才傳新值進行binding的同步。(相關:爲何只有textbox lose focus之後,數據纔會刷新??)
txtModel.DataBindings[0].DataSourceUpdateMode = DataSourceUpdateMode.OnPropertyChanged;
默認值是OnValidated