views:

100

answers:

1

I'm building a dashboard'ish application for a special purpose hardware that has physical buttons that are bound to F1-F10, Up, Down, Backspace, Enter. The application consists of a few views (implemented using the MVVM-pattern) and most of the user interaction are done with menus that are aligned near the physical buttons. I'm trying to toggle the menu state by pressing the F-keys but I just can't get the bloody thing to work!

I've (successfully, kinda) tried an alternative solution that catches the F-keys and sends them as regular numbers 1-10 and mapping Alt+[1-10] to the meny using Accesskey. That is not an optimal solution though since I have to keep track of if the menu looses focus (the user can also navigate with a touch screen). Besides that I also have try and hide the accesskey-text from the menuitem-header (since it seems impossible to just make it invisible).

A: 

Honestly, I'd just make a regular Window and hide/show it as appropriate - just have an ItemsControl whose DataTemplate is a MenuItem. Menus are managed in the standard "menu" way, so it'll be hard to override it and manually manage the hidden/shown state.

Paul Betts
I went another direction and solved the problem by deriving a class from MenuItem that listens to when a key is pressed (which can be set from XAML with a property). It seems to work exactly as I require! Thank you very much for your input though!
scim