key bindings - How do I implement wpf keybinding -


i want able allow users change hotkeys @ runtime.

does have concrete example on how bind key in codebehind c# accomplish this?

i assume have keybinding routedcommand. assume want push button on ui hotkey.

eg... let user push f5 click btngo on app.

the way commands work bit different thinking. when press button doesn't fire click button in app. rather, define command (in case, have command called "go") , can assign command various elements in application (menu items, buttons, etc.) of these items fire command , command has "executed" function performs code.

if add commandbindings main window can use hotkeys fire commands globally. can place command bindings in xaml such code as:

<window.commandbindings>     <commandbinding command="local:mycommands.go" canexecute="gocanexecute" executed="go" /> </window.commandbindings> 

to create own command can create "routeduicommand" in code , set default members (default name, default keybind, etc.). want make static property of class.

then if want change or add keybinds command can access static property , modify inputgestures collection. can clear it, add new key bindings, , change them necessary.


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -