mvvm - Get event args in view model of a wpf program -


i have program need access characters typed keyboard view model. can obtain keyeventargs in code behind using keyup method, how access in viewmodel? please help.

you need following pass keyeventargs viewmodel  1. interaction triggers in xaml because native input binding don't support keyeventargs <textblock> <i:interactiontriggers> <i:action eventname ="keyup"> <multibinding command={binding somecommand, converter={staticresource eventconverter}}"> <binding ...> <binding...> </multibing> </i:action> </i:interactiontriggers> </textblock>  2  create custom command  (example, relay command) can initialize command below in viewmodel  var cmd = somecommand; customcommand c = new relaycommand<keyeventargs>(cmd.execute, cmd.canexecute);  3. in command action, can access mouseeventargs or keyeventargs.  if more, you'll idea. 

Comments

Popular posts from this blog

ruby on rails - RuntimeError: Circular dependency detected while autoloading constant - ActiveAdmin.register Role -

c++ - OpenMP unpredictable overhead -

javascript - Wordpress slider, not displayed 100% width -