开发者

Unable to create Event Handler WPF

I am unable to create Event Handler when i double 开发者_开发技巧click on button or anything this messagebox appears

Unable to create Event Handler WPF

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 :)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜