Visual Studio 2012 adds _1 to the click event handler

Visual Studio 2012 adds _1 to any click event handler that I create in XAML

that is: I create a new WPF solution, drop the button, in XAML give the button a name, type 'click', and intellisense displays a β€œnew events handler”, I click on it, it creates an event, but its name is btn_test_click_1

In VS2010, we are not getting _1, how can I stop this by driving it crazy?

UPDATE I can confirm that this has been fixed using VS2012 Update 2

+7
source share
3 answers

I can confirm that this has been fixed using VS2012 Update 2

+1
source

This only happens when the IDE sees that an existing event handler of the same name has been created. Make sure you delete the event descriptor information from the code file, then go to the aspx file and delete all the event handler controls in the control. Then save the file.

0
source

You can delete _1 manually, and as you say, you have only one event handler, so there should not be any other code logic that will be executed on your event.

0
source

All Articles