views:

85

answers:

1

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

+2  A: 

Hi,

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

LBugnion
Can you also provide some samples/Demo-Videos on how to use the Messenger class in MVVM Light? Your demo on MVVM Light in SilverlightTV does not cover Messenger Class. Thanks.
Veer
For the Messenger, see my MIX10 video where I show an introduction to this class:http://live.visitmix.com/MIX10/Sessions/EX14Also, check a much more meaty sample here:http://blog.galasoft.ch/archive/2009/10/18/clean-shutdown-in-silverlight-and-wpf-applications.aspx
LBugnion