In any application, hotkeys (shortcuts) are useful for navigation as well as to launch a control’s code, unfortunatelly Hotkeys in WPF are not as easy as in Windows Forms.

In this post we will briefly present an example of how keyboard shortcuts can be used to execute commands using key bindings. What you will need is to create a new WPF window and follow the instructions below.

Step 1: In the mainWindow.xaml you have to put the following parts:

 

Step 2: In the mainWindow.cs you need to assign the corresponding methods

 

Author

Write A Comment