I am working on WPF project, and after I made everything in Xaml file I wanted to start doing on my CS file. Now, I was trying to add event using that little bolt in properties, but everytime i click on any event (for example I select button in XAML and try to add -> MyButton_Click) i get a pop-up message "UNABLE TO ADD EVENT HANDLER".
I hope you are able to help me.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With