Click to See Complete Forum and Search --> : Autogenerated XAML and initializecomponent


Thekiwi
October 14th, 2009, 04:46 AM
Hello:

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
|_ 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

nishantcop
July 19th, 2010, 05:06 AM
You may try to correct the reference in .xaml files

provide correct namespace there