Do I need a BindingSource AND a BindingList for WinForms DataBinding?

前端 未结 2 622
孤街浪徒
孤街浪徒 2020-12-14 22:35

I want to display a list of people in a DataGridView in a Windows Forms app. I want my service layer to return a list of Person objects (e.g., IList

2条回答
  •  再見小時候
    2020-12-14 23:08

    If you use BindingList then changes that you make through the underlying list will be reflected in the data bound controls because BindingList raises an event when the list is changed. Most other collections do not.

    If you use a normal collection as the data source then changes that you make through other data bound controls (or through the BindingSource) will still be reflected, but changes to the underlying collection directly will not.

提交回复
热议问题