I am unable to create Event Handler when i double 开发者_开发技巧click on button or anything this messagebox appears
how ever when i add event handler manually it works.any idea what might have i screwed up thanks
The class in question is the "MainWindow" class within you MainWindow.xaml.cs
file. Make sure it's the first class in the code behind file.
I suspect you added another type to that file, and defined it at the top. It will "break" the designer, and give you this error message.
Move the class code so that it is the first class in the file and try again.
there was another class on top of main window in .CS file that is why it was doing problem.
If you have renamed the window make sure it has affected to the code behind file too as you can see in the xaml designer code. Compare the class name and window name all the places. I had the same issue and noticed when I renamed the window the associated code behind class name didn't automatically updated. So I did it manually and it was gone for good. Hope this helps :)
精彩评论