I’m using a BindingList in a UserControl to determine update the UI of the Control. ListChanged and AddingNew events are assigned in the constructor.
I was finding that the BindingList’s events were not being fired and after a bit of exploration found that the onListChanged and onAddingNew event handlers were null.
After even more digging I found my problem – that the UserControl’s parent form’s designer is creating the line:
this.myUserControl1.MyBindingList = ((System.ComponentModel.BindingList<MyCustomClass>)(resources.GetObject("myUserControl1.MyBindingList")));
Any ideas how to stop the designer from redefining this BindingList?
I think I may have fixed it – I added the following above the definition of the property in
MyUserControlAlthough to be honest I was messing round with a lot of stuff and it may have been any number of things (all to do with serialization of
MyCustomClass– it was initially Serialized due to the designer complaining about it not being serialized but then this broke other things).I will wiki-fy this answer in case anybody comes up with a more solid answer!