Visual Studio 2013 and C# - Unable to add event handler

yes, @will is right, I also suffered from the same problem,when i was new in WPF. Please check your x:Class in your XAML file, it should include the namespace used in code behind. e.g., x:Class="MainWindow" should be some thing like x:class="namespace.MainWindow" if it doesn't work,try to restart the VS or try to recreate the project with correct name, hope it will solve your problem.


I suffered from the same problem like you. Error occurs when you have any syntax error in your XAML file like misspell, missing tag, comma, lack of method/event handler or difficulties with references.

Exactly the same reason is when you are unable to add event or change any property in Property Window, but without any message or error. Check your syntax carefully.

Regards.

Tags:

C#

Wpf

Xaml