Click here to Skip to main content
15,889,200 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all

Please tell me how to open an existing window by assigning shortcut key.

e.g. if i press Ctrl+S then it should open settings.xaml window.

Please tell me how to do this
Posted

1 solution

Hello,

You need to use the InputBindings and KeyBinding classes, as following:

C#
<window.inputbindings>
 <keybinding command="ApplicationCommands.Open">
       Gesture="CTRL+R" />
</keybinding></window.inputbindings>


Also, here's an article to help you out: http://stackoverflow.com/questions/1319425/application-level-shortcut-keys-in-wpf.
 
Share this answer
 
Comments
[no name] 24-Mar-14 7:28am    
Where to write this code..?
Christian Amado 24-Mar-14 8:07am    
Inside your XAML file in the parent control (not in openSettings.xaml)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900