I mentioned in an earlier post that for a control in a Windows Presentation Foundation (WPF) application that you had to give each control that you wanted to write code behind for a name in the XAML of the form.
Strictly this is not true. If you want don’t want to use the built in features of the Visual Studio’s IDE for selecting classes and methods on the code behind page you could type in the code on the code behind yourself.
For me, at least, the easiest way to reach the code behind is to give each control a name in the XAML markup

then from the code behind page, you can select the control from the dropdown list.

After you select the control, you have access to all the events associated with the particular control.

By selecting a method from the list Visual Studio automatically generates the method declaration for you.

Once the declaration is made you can happily enter the necessary code you want for that event.
If you don’t want to take advantage of this great feature of Visual Studio, then you can write methods for controls the slightly more difficult way.
Instead of giving your control a name in the XAML of the form, have toadd an attributes for the control in the XAML.
The attribute needs to include are the action of the control you want to code against and the name of the method that you will write on the code behind.

Once you have added this to the XAML, go to the code behind and declare the method adding the two required parameters of Object and RoutedEventArgs.

Then you can add the required code for that method just as you would if you had Visual Studio declare the method for you.
So there you have it. Two ways to reach the code behind with a Windows Presentation Foundation (WPF) application.