WPF Reflections

Dec 21 2007   2:57PM GMT

InputBindings

Mark Shurmer Profile: MarkWPF

Have you discovered InputBindings?

They allow you to specify a connection between an input device and a command. Examples of input devices are keyboard and mouse, and examples of commands being anything implemented with ICommand.

Therefore, you can add an InputBinding to take advantage of commands that you have already defined and bound in your CommandBindings section, eg:

<ListView.InputBindings>
           <
MouseBinding MouseAction=LeftDoubleClick Command={x:Static gcmd:RoutedCommands.ViewMyPosition} />
           <>KeyBinding >Key=>“B”  Modifiers=“Control”  Command=“ApplicationCommands.Open” />
</
ListView.InputBindings>

This allows you to double click the mouse and invoke the custom command ViewMyPosition, and press Control + B to invoke the built-in command Open

 Comment on this Post

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when other members comment.

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

Share this item with your network: