问题
My window has just a listview. This facilitates the users to incremental search the db. Since the design does not have a textbox, i've to globally handle the keys. I think it could be achieved by keybinding. But how can i handle all the keys and associate it to a single command.
Also suggest me other methods if any.
P.S.: I want this in xaml
回答1:
I would use an EventToCommand binding the KeyDown event to a command on the ViewModel. You can set PassEventArgsToCommand to true, and use a RelayCommand to find out what key as pressed.
All these objects are available in the MVVM Light Toolkit
http://www.galasoft.ch/mvvm/getstarted
Cheers, Laurent
来源:https://stackoverflow.com/questions/2660069/multiple-keybinding-to-a-single-command