I'm creating XAML pages from code, with a XMLWriter. No problem adding buttons, textbox, etc... So, i add to XAML file his XAML.CS with constructor etc.. . For example:

|_ Customers.XAML.CS (With CsharpCodeGenerator)

My problem is when I try to bind a control from this XAML to a event, for example, button1_click(). I create in the XAML.CS file an empty "InitializeComponent method". When I doubleclick control in my XAML to bind the event, this method is created but when I compile it, returns an error:

"Error 2 'CUSTOMERS1' does not contain a definition for 'button1_Click' and no extension method 'button1_Click' accepting a first argument of type 'CUSTOMERS1' could be found (are you missing a using directive or an assembly reference?)"

How could I create a correct InitializeComponent() by coding?

Thanks and regards