As STW already mentioned you need a BindingList<T>
so that a change within the list will be propagiated into the BindingSource.
The next step is how will your UserControl being notified about changes in the BindingSource. To solve this problem add this code as starting point to your UserControl.cs:
private BindingSource _DataSource;
[TypeConverter("System.Windows.Forms.Design.DataSourceConverter, System.Design")]
[Editor("System.Windows.Forms.Design.DataSourceListEditor, System.Design", typeof(UITypeEditor))]
[AttributeProvider(typeof(IListSource))]
public object DataSource
{
get
{
return _DataSource;
}
set
{
//Detach from old DataSource
if (_DataSource != null)
{
_DataSource.ListChanged -= _DataSource_ListChanged;
}
_DataSource = value as BindingSource;
//Attach to new one
if (_DataSource != null)
{
_DataSource.ListChanged += _DataSource_ListChanged;
//ToDo: look for other (maybe usable) BindingSource events
//http://msdn.microsoft.com/en-us/library/system.windows.forms.bindingsource_events.aspx
}
}
}
void _DataSource_ListChanged(object sender, ListChangedEventArgs e)
{
//ToDo: Reacht on specific list change
switch (e.ListChangedType)
{
case ListChangedType.ItemAdded:
break;
case ListChangedType.ItemChanged:
break;
case ListChangedType.ItemDeleted:
break;
case ListChangedType.ItemMoved:
break;
case ListChangedType.PropertyDescriptorAdded:
break;
case ListChangedType.PropertyDescriptorChanged:
break;
case ListChangedType.PropertyDescriptorDeleted:
break;
case ListChangedType.Reset:
break;
default:
break;
}
}
With this you will be informed if anyone makes changes to the BindingSource itself (exchange the whole list against a new one) or on the list of elements attached to the BindingSource.
Also you should really good test it, cause some controls have a little weird usage of lists (e.g. instead of changing some elements on a list, clear it and fill it up from scratch).
Maybe this Walkthrough from Microsoft can help, too. I didn't read it, but it looks promising.