When is it worth using a BindingSource?

后端 未结 3 1223
萌比男神i
萌比男神i 2021-02-02 08:20

I think I understand well enough what the BindingSource class does - i.e. provide a layer of indirection between a data source and a UI control. It implements the IBindingList i

3条回答
  •  夕颜
    夕颜 (楼主)
    2021-02-02 09:02

    Hi I also have some confusion about the subject.
    When I use datatables those implement all the interfaces.
    However I always use the bindingsource just to be sure.. :)

    There are some arguments why that I can think of

    1. Multiple views on the same recordset. (ie. 2 grids with diffent sort orders/filters)
    2. Filtering,Sorting while not changing the sort order of the records themselves (Filter/Sort)
    3. Ability to disable binding for a while for performance reasons. (when there are big updates in the table, don'y listen to all the IXXChanged events)
    4. IErrorprovider never worked for me without a bindingsource, however this could be my fault.

提交回复
热议问题