Any patterns for hot keys handling ?

Topics: Prism v4 - WPF 4
Jan 25, 2012 at 4:17 PM

looking for some best practices for generic hot key handling for prism 4 where

given an app with multiple views display incl

multiple instances of a view with a grid where F4 key toggles the column text color between red and black

this F4 key only works on the current active grid/instance or view

not all views have a corresponding action for the F4 key

 

I built some code for cab that worked well but looking for the wpf/prism way of doing things !!

 

Developer
Jan 25, 2012 at 6:05 PM

Hi,

As far as I know, prism does not provide guidance about this topic as out of the box. As a possible approach to achieve the scenario you are mentioning, I believe you could use KeyBindings in your view/s to invoke a command in the corresponding view model.

You can find more information about KeyBinding in the following article in MSDN:

Regards,

Damian Cherubini
http://blogs.southworks.net/dcherubini

Jan 25, 2012 at 7:17 PM

Is there an app level pattern where the app has multiple windows ?

Developer
Jan 26, 2012 at 5:46 PM

Hi,

I believe you could find the following blog post by Damian Schenkelman useful where possible implementation for a multiple shell scenario is proposed:

Although this approach (and the corresponding sample application) is targeted to prism-v2, I believe you should be able to implement it in prism-v4 easily. 

Also, there are several threads in the community about multiple windows applications that you might find interesting, for example:

Regards,

Damian Cherubini
http://blogs.southworks.net/dcherubini