I can directly bind my DataGridView control to a bindinglist of my business objects by setting the DataSource property. My business object implements INotifyPropertyChanged, so the DGV gets updated when a new item is added to the Binding List or existing one is updated.
With respect to dealing with single records, I can bind my business object to textboxes and other relevant controls.
I can also derive from BindingList and create a CustomBindingList class to implement required methods of IBindable, as explained in the link below : http://msdn.microsoft.com/en-us/library/aa480736.aspx
Alternatively, I have seen people recommend using a BindingSource. BindingSource's Datasource is the business object and the DGV's DataSource is the BindingSource.
In any case, basing it on a BindingSource does not offer me:
- Filtering (Filter does not work). Implementation needs to be provided by me.
- Sort and Search does not work. Implementation needs to be provided by me.
So, Why is the BindingSource approach recommended?
Broader Picture: Am new to OOPS concepts and C#. Working with Database applications. Winforms. So far have only used DataSet / DataTable approach. Now trying to create and use my own custom classes.
Typically have a Master/Detail form. When I click on a Detail row in the DGV, I want to edit that record in a separate window. So I need to get a handle on the list item represented by that row in the DGV. Trying to find a solution for that has brought me to this point and this doubt.
Given what I want to do, which approach is better and why?
Some pointers here would really help as I am very new to this.