wpf - Cannot create an instance of usercontrol1: "The Enumerator is not valid because the collection changed" -


i tried inherit method button1_click, code below compile when drag , drop usercontrol1 on mainpage toolbox got error message:

"the enumerator not valid because collection changed"

update: why , silverlight creates collection behind scene event handlers because created none myself code below whole code ? has ever tried visual inheritance ? possible in winform why wouldn't silverlight ?

update2: seems here capable know how visual inheritance works try msdn forum if answer post here.

update3: whole project http://www.filesonic.com/file/895613324/visualheritance.zip

namespace visualinheritance {     public partial class usercontrol1 : usercontrolcommon     {         public usercontrol1()         {             initializecomponent();             this.button1.click += button1_click;          }      } }    namespace visualinheritance {     public partial class usercontrolcommon : usercontrol     {         public usercontrolcommon()         {             initializecomponent();         }          public void button1_click(object sender, routedeventargs e)         {             messagebox.show("usercontrolcommon");         }     } } 


Comments